From patchwork Fri Feb 2 15:36:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769228 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973917wrc; Fri, 2 Feb 2024 07:39:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9CvJ6gWreI6e1qMfwdPgcap4qAoJYw/7mcYl7GKyUWYAzsQLZ1qSfzXsP6ZKUOcJrytaJ X-Received: by 2002:a05:6808:1295:b0:3be:a7ea:3855 with SMTP id a21-20020a056808129500b003bea7ea3855mr9701398oiw.25.1706888369931; Fri, 02 Feb 2024 07:39:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888369; cv=none; d=google.com; s=arc-20160816; b=T988Bwd+sWBsyndDIg50gfDySE1kAFmgww/RvX+y034GD4xEpN84XeuganrSIhInE0 WLY3FQdFuM/67dhmd7w6pbNcSWBjm2I2SRsKRXRUzypQ5A7k+hhY7EcUHIHkrQwVDi7R x72i/hFbYep3zCFnHlM1GAxbR04tXDZuysLJIijiP7LtwMoIIDy9DQsWh3tLdmawm0UB dIsW7CH1KxXS+gzqs2xuVIhzhVxnBPfjT9w1y1gAUYAGq6syfEiiIb3mA7sQntqdm16n f2anHrHRmvFhwe0cpZ6shz91Idya5yUs7uYIiYI6LLHUxwRDCBjZTLi1I35L0VgVnJqo 5E8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7kvYGJv6Vs1OqeEsvp2TCyEKspSHCOA1Tp8iJFztpkE=; fh=7DOx0s6NirdiRLZoH8LX7gJfz5ypDadPDaz692l0h4I=; b=FJG34EMKxuH8U+R8rTHiSLRA/jtiEReVjNYLuObb8seF18VuBQbmBkHMhGLSEf6apQ +muVvNu6Hxh0n0ZlopVJjXdLdUQgdLNlMgDiH4kItAvI6oqpyojz4juEx0FYVg/gpJDG RRZ+bLcvGzeaPWRiBhGeB8q9M5o4JG7lOzQhKMT2bUQnvus8tQc2w+6Q25vRjQOG1bKR dsBzI+jcFc4bFmXXnUOnEpnRhCjjE7I5GxcTr/pJRZoLGVJC15cYNHYdY0eI/fvgYqR2 w9V5N9HGSBm2d8lyYIl5fKGJRG3zykNyl2zAfyjNdBq3fikvLbkIlqkgFN/LTo9EN7tP TQYA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rKo9NUzq; 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 X-Forwarded-Encrypted: i=0; AJvYcCXlryyUtLrgJxWR31uuwuD+K0QUWNJhaBpQYABx3FYMVAFwnBps8pYgkjXAORypVUokmhk29mbOca9bZ3/Fl4Zr Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x14-20020a05620a0ece00b00785343838a5si2114825qkm.194.2024.02.02.07.39.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:29 -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=rKo9NUzq; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb6-0000Nk-G0; Fri, 02 Feb 2024 10:36:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVvb2-0000Kq-Nn for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:52 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb0-0004UG-5W for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:52 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40fc52c2ae4so8265555e9.3 for ; Fri, 02 Feb 2024 07:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888208; x=1707493008; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=7kvYGJv6Vs1OqeEsvp2TCyEKspSHCOA1Tp8iJFztpkE=; b=rKo9NUzqs00wPWGkjQWt7Ot2zplIsNVBU/S3u7iJop1OLAygx3f+YrzjuADIGkuxHu TfixQkK/3jRN2hwfPmGIovQZnWlOMw2Pk/abqan1Kqrt84Lsc7cHYchwQv9F7YNzxM1n JbumORK55E6p+WHxBKABvFV650KzILXqwlVpCjIF1zde+yp3Rlf3wmII2FlKdDy7D3L4 a23Pm6DFn/40M+NG1jHqiizAr0CGm0uSBLMNak8PJw3AFdATF9VkXN+VMHq74aZdyFmv Ex0NYZF2dW+AGJHilvKxaGa8FW6VN0kG+euVaGWH3kQ4uarAOBOiUSKu9k/8SdFP4Mru 1l0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888208; x=1707493008; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7kvYGJv6Vs1OqeEsvp2TCyEKspSHCOA1Tp8iJFztpkE=; b=NTZ6nrYw4RfK6xYTq8ORyxA7RrkUROj21MR2357rwfnOfncuN6IxG7Vu1c+Cfc6Q+C Fj2qsdWLCpqH651rU/GQPpDrOyr/9vaedlRp0Qmd7vOTVSyZ+6+PJx7lI8dbMw61EZWe 5NJd4VU+kL+2sTXDx04z9fPm5L3TTGjNQVIAstqGHeiVwY4+kmAs2/JUBun6a23gM2BS OGWgbvMqg1tVxUxu2Vy5A7pHP9EjQDJPjBkfL8RsFWyYZbiLxyRD2XYDFzalpa2kn7Xw q7foKxvbWOmfCfb776EJb9F1yNgw3yzB1pqRtCh86fvhCjyVwJwICrPQayOF1k8uvPZ2 RMqQ== X-Gm-Message-State: AOJu0YztWqsbK6NNGkTKDwOlmDUKo2fJ3D+Ji4hn7Gru3DjzzGxgSob0 HAx7a8lc9aGlhzRZYEMF+vytFzJas0/TDeojmJ0cmCyO9JKWSkH3BSxw9XsU5kgYQPdnaKPiA6d 4 X-Received: by 2002:a05:600c:3153:b0:40e:4f81:3f68 with SMTP id h19-20020a05600c315300b0040e4f813f68mr1791910wmo.16.1706888208769; Fri, 02 Feb 2024 07:36:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/36] pci-host: designware: Limit value range of iATU viewport register Date: Fri, 2 Feb 2024 15:36:23 +0000 Message-Id: <20240202153637.3710444-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Guenter Roeck The latest version of qemu (v8.2.0-869-g7a1dc45af5) crashes when booting the mcimx7d-sabre emulation with Linux v5.11 and later. qemu-system-arm: ../system/memory.c:2750: memory_region_set_alias_offset: Assertion `mr->alias' failed. Problem is that the Designware PCIe emulation accepts the full value range for the iATU Viewport Register. However, both hardware and emulation only support four inbound and four outbound viewports. The Linux kernel determines the number of supported viewports by writing 0xff into the viewport register and reading the value back. The expected value when reading the register is the highest supported viewport index. Match that code by masking the supported viewport value range when the register is written. With this change, the Linux kernel reports imx6q-pcie 33800000.pcie: iATU: unroll F, 4 ob, 4 ib, align 0K, limit 4G as expected and supported. Fixes: d64e5eabc4c7 ("pci: Add support for Designware IP block") Cc: Andrey Smirnov Cc: Nikita Ostrenkov Signed-off-by: Guenter Roeck Message-id: 20240129060055.2616989-1-linux@roeck-us.net Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/pci-host/designware.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c index dd9e389c07b..c25d50f1c6b 100644 --- a/hw/pci-host/designware.c +++ b/hw/pci-host/designware.c @@ -340,6 +340,8 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address, break; case DESIGNWARE_PCIE_ATU_VIEWPORT: + val &= DESIGNWARE_PCIE_ATU_REGION_INBOUND | + (DESIGNWARE_PCIE_NUM_VIEWPORTS - 1); root->atu_viewport = val; break;