From patchwork Mon Feb 21 14:07:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 544433 Delivered-To: patch@linaro.org Received: by 2002:ac0:e142:0:0:0:0:0 with SMTP id r2csp3267155imn; Mon, 21 Feb 2022 06:13:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbU7gj2IybDsiuOq+m20hSm9JfUzOXLNaqxut/C924+i3Ql4W1Q0N6aVy/ORzrCczl5UgC X-Received: by 2002:a05:620a:807:b0:47d:27f5:466c with SMTP id s7-20020a05620a080700b0047d27f5466cmr12226905qks.424.1645452818934; Mon, 21 Feb 2022 06:13:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645452818; cv=none; d=google.com; s=arc-20160816; b=NRGqWBMgZwncZvNtjlCIp+8v5pjLlMuGs+bhXOoI6y34AYTHXntSqnBTJMLK5Xwp9r Yer59C2ytZqFQpdzwGLnw2+szdmOvwTwH2zGL/h3+k37TZsLqtsFk1dw6myikT1YWkwn A633U9E4X86S7ZrLuHPCgCtbEBLO4GCAgFCP7niwKbaZCXvXxMjs5ASYYVvcuzIobEio ytiITi0Pfw+B8G4WFeZvnVTVgtxeOSwsuUWAb8az23FGzkbrq/lSls61tdaocwRKrbJO Wi+eLt+DKeNZmHpPQ4XjGMnsOI7x0hbjkhBsNIY1V7p4dimBuoVRm5BVtuC30/zEMcl4 sBYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=lkWx7QGGS8WiDESf3HzDhqm0HFpYN0QbjJr4eJ5EUck=; b=GW9GE03Iok1kG+WLIkccuVdV5dDh/jrzp7r8MD7XSpjn8pOSPdWCelA1yI2Gr9JSrl 9F7xlLwhAqX/PRwcuqnQ98RV7YOaHmNS6LQHWOkp2I90pChAXh4Dm17P1DU8Gw7M8rNM eVM/HICsK1OveHtK7egGo1zD8qw+6BnqqvhCwprbDXYmifdzTkX8C0heAqkw/Nkj6tq0 8UUyBT5E2EG65oJQRTnAcvQ6FL7wVdXij+fLswS0kt2IiQZ6PwtfIgSlmfWrfL6G+RJJ +Pw3eG3MEak3dpw6D9vVbCtjN+jxAWbBk/66eKWxhTHod/yf7Jn2W03gZlnrJsLOPfjU wCqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MA+iHguQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id iu11si13800273qvb.186.2022.02.21.06.13.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Feb 2022 06:13:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MA+iHguQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nM9Ra-0000m8-HC for patch@linaro.org; Mon, 21 Feb 2022 09:13:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nM9M5-0002jk-Kz for qemu-devel@nongnu.org; Mon, 21 Feb 2022 09:07:57 -0500 Received: from [2a00:1450:4864:20::42b] (port=43894 helo=mail-wr1-x42b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nM9M2-0007AX-Vs for qemu-devel@nongnu.org; Mon, 21 Feb 2022 09:07:57 -0500 Received: by mail-wr1-x42b.google.com with SMTP id s1so867940wrg.10 for ; Mon, 21 Feb 2022 06:07:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lkWx7QGGS8WiDESf3HzDhqm0HFpYN0QbjJr4eJ5EUck=; b=MA+iHguQp6cxeUPl//YOmWMzt0KxwHN8hYOJlUrPiqGGfdfB5/YDsu2UPElvri19C/ SodtW2Es+gQrDKmWR5up+mN7lY2rBxeb24qKh7YC+g+8alZ6+bF7jzFPtPzd8TfIszWC M8WtZ7V45C1wrtNv3n6ibg/Urcq6wQBXYny6Nm5EdELac1jtjG0SSXWMCyw91hpcBrT+ Tqt8vpl0YqSodqMLgacelOX2j7etLniTyPz+sO4aCySVePEq5LvOMzmSWD0pkFFQC32o y4n27sD3+/qRlBkKSolJzTFyi8+tWZwvZr4VpQK9QtqKbaGkmW39QDKhCo7WCner+eZ4 bJpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lkWx7QGGS8WiDESf3HzDhqm0HFpYN0QbjJr4eJ5EUck=; b=ZwiUZKO4B7Vhbu4pibTT8QTRKpjbgBmZ/3/QW1Zly6GKJHs7iKg6mMe7ubqw7BmUog ZPRWgbNhP5pn044HOUIQw8QUc7KD0Z2xfETMc5CKMFcfitQdOg2QUDA8jlWagivkj66f rvTeLwNdhwcFVmtvB1+9Gi3YH3J51L6v20y8ojHHo808Rjz9oQlCs8K9SXoW90L4OIkE 12JY68N/AJBQjJa8VUF0/7S7yn0j61qiUyKISbIRk0OmvBt41gougfln+7cjVGU5bhOY SJzYAJoJeYXknhg0oShaYWO+hlOfYP81jWOoaVLkTQRkUQ3qBGWapoyyR0pdMMRjdFwk ZuYQ== X-Gm-Message-State: AOAM530HT78Sn1be1O+X36ACgVYBAhByF2wAAFrTu1/eV006DKtsLL4j xkpgXvQ1geUc/koZlS7jqWv+PQ== X-Received: by 2002:a05:6000:23b:b0:1e4:a4d1:a9f3 with SMTP id l27-20020a056000023b00b001e4a4d1a9f3mr16143296wrz.278.1645452473046; Mon, 21 Feb 2022 06:07:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id x10sm14024253wre.110.2022.02.21.06.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 06:07:52 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH] hw/input/tsc210x: Don't abort on bad SPI word widths Date: Mon, 21 Feb 2022 14:07:50 +0000 Message-Id: <20220221140750.514557-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42b (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Cleber Rosa Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The tsc210x doesn't support anything other than 16-bit reads on the SPI bus, but the guest can program the SPI controller to attempt them anyway. If this happens, don't abort QEMU, just log this as a guest error. This fixes our machine_arm_n8x0.py:N8x0Machine.test_n800 acceptance test, which hits this assertion. The reason we hit the assertion is because the guest kernel thinks there is a TSC2005 on this SPI bus address, not a TSC210x. (The n810 *does* have a TSC2005 at this address.) The TSC2005 supports the 24-bit accesses which the guest driver makes, and the TSC210x does not (that is, our TSC210x emulation is not missing support for a word width the hardware can handle). It's not clear whether the problem here is that the guest kernel incorrectly thinks the n800 has the same device at this SPI bus address as the n810, or that QEMU's n810 board model doesn't get the SPI devices right. At this late date there no longer appears to be any reliable information on the web about the hardware behaviour, but I am inclined to think this is a guest kernel bug. In any case, we prefer not to abort QEMU for guest-triggerable conditions, so logging the error is the right thing to do. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/736 Signed-off-by: Peter Maydell Reviewed-by: Alex Bennée --- hw/input/tsc210x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index 182d3725fc9..e0362d71719 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -23,6 +23,7 @@ #include "hw/hw.h" #include "audio/audio.h" #include "qemu/timer.h" +#include "qemu/log.h" #include "sysemu/reset.h" #include "ui/console.h" #include "hw/arm/omap.h" /* For I2SCodec */ @@ -909,8 +910,11 @@ uint32_t tsc210x_txrx(void *opaque, uint32_t value, int len) TSC210xState *s = opaque; uint32_t ret = 0; - if (len != 16) - hw_error("%s: FIXME: bad SPI word width %i\n", __func__, len); + if (len != 16) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: bad SPI word width %i\n", __func__, len); + return 0; + } /* TODO: sequential reads etc - how do we make sure the host doesn't * unintentionally read out a conversion result from a register while