From patchwork Sat Oct 24 01:49:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1387019 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=CrkpUm+Y; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CJ3wL3vTHz9sSn for ; Sat, 24 Oct 2020 12:50:55 +1100 (AEDT) Received: from localhost ([::1]:58762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kW8ho-0003yo-Ir for incoming@patchwork.ozlabs.org; Fri, 23 Oct 2020 21:50:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kW8hK-0003yS-36; Fri, 23 Oct 2020 21:50:22 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:45854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kW8hI-00017J-IE; Fri, 23 Oct 2020 21:50:21 -0400 Received: by mail-pf1-x441.google.com with SMTP id e7so2820623pfn.12; Fri, 23 Oct 2020 18:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KUa8ua5YuGfWsHWpW7218Ha7emqQTAdJ1paNsVxfgSI=; b=CrkpUm+YwLHtPvOvvPfhsgXm57tE5K7hAGJ1RN0CENTu4xVMa12jvIqIv9KLvAdxoh gtkHKvnruhmx70fxIRFQLxVlqmDoUCw8w4zeR+2souH6huXOiz6oAhQQXnaU6rxyofxz MDCwnoU7vl+bSbFh6h0BWpxQDDypbOQH2Z1OSJDYbtrsYxjyoOVkWK9F2+3F07DWdAPp kPRHmPUy57yi8b+ljMonEAls5+7wgtxRnaE2PpHxfuS8hrt5d/IGYB95EAMQ41o0AOH5 oaQ/wlIRz9eg/DieWIGWClTI004ywsDOIGcoBuWQWf8WMQGF/7ly51GekqUqVaALzPz7 63GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KUa8ua5YuGfWsHWpW7218Ha7emqQTAdJ1paNsVxfgSI=; b=PY3bz7yWp/UZNmJU0aQY8pH1e7JAE8GK+CCsNsr6+JNxIUS6ind5gItkgi5XVZbrcY TPi8EuHtB0CwjxpwTg21miM+5RZyEbvA2fPnsJiEjmgGmame6kBEJB0+PxYQpeW/oC44 o0ZyueyRI3zmF4JfEi/HLiUn1AU/XFpGxjAn/NxPuhOLEusypXhKxGlMf9ycHhQ+OyAy z7knnHHThiiwW8d3nVknO4NaULCkIHPkIZUXG5sCdvHHI62kG9MRb8ZfP7gYtCHOys2V pS9dSseAfzV/dF04JJVXae7Lim2YM8ewxHFdFZf8ncsxSi6ML/JrP8/kwkkJ9TPnH5c4 cxOQ== X-Gm-Message-State: AOAM533ig1FbzO1qbkQGkjYpMdHH13QpY9TRSPsXfIkKWVRrx9rSK2xR 7iPkhy409iZul9fLSz5iL4k= X-Google-Smtp-Source: ABdhPJygImpEKZbLAHqEKbMPNY8iZXx0slFSMVy63FJ/wd9yKqBcYi3exEtpNBxiM3zTfKabFkN2Mg== X-Received: by 2002:aa7:9424:0:b029:15d:5340:83b0 with SMTP id y4-20020aa794240000b029015d534083b0mr1890449pfo.73.1603504218737; Fri, 23 Oct 2020 18:50:18 -0700 (PDT) Received: from Intel.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id q13sm3515900pfg.3.2020.10.23.18.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 18:50:18 -0700 (PDT) From: Bin Meng To: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH] hw/sd: Zero out function selection fields before being populated Date: Sat, 24 Oct 2020 09:49:54 +0800 Message-Id: <20201024014954.21330-1-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::441; envelope-from=bmeng.cn@gmail.com; helo=mail-pf1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Michael Roth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng The function selection fields (399:376) should be zeroed out to prevent leftover from being or'ed into the switch function status data structure. This fixes the boot failure as seen in the acceptance testing on the orangepi target. Fixes: b638627c723a ("hw/sd: Fix incorrect populated function switch status data structure") Reported-by: Michael Roth Signed-off-by: Bin Meng Reviewed-by: Philippe Mathieu-Daudé --- hw/sd/sd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index c3febed243..bd10ec8fc4 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -824,6 +824,7 @@ static void sd_function_switch(SDState *sd, uint32_t arg) sd->data[12] = 0x80; /* Supported group 1 functions */ sd->data[13] = 0x03; + memset(&sd->data[14], 0, 3); for (i = 0; i < 6; i ++) { new_func = (arg >> (i * 4)) & 0x0f; if (mode && new_func != 0x0f)