From nobody Mon Feb 9 23:02:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1769703258; cv=none; d=zohomail.com; s=zohoarc; b=ORF4Aeuh1GN6J5w43OJiGVuX4/p9noLhMuGkVjD2omQTYnDeJmSjbGhMuE+mqglzoO9g5jLIqFN8phzbwaty0EHXSd5jZCJcSgf1TTdlrSdhbzzbcL2hvi0cRqMWsoMNJ3AZmU90afgcNKMoZGZ/27WPY5HZAXQWAX2R6T270LY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769703258; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=g7u4vFyrJCbAlZ8RKPYksrp2vL/fqFoBrZQZKiBf15A=; b=ms7YMOXLkYpvk4JxBgNaBSS2B9tKBFGsGxfeTI5xo1Wf+Hox50KH3Sz2fO0q4kEHF/qemaHbscrBqyKpE/D4L9Q3pG+aXMgKj/F7GD62+lb5vkI2nCXkVn412EGuKTcPvW12KkvFyErd50KoKYLesWM7DBdeTZjM6307WBmEc0g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769703258588444.54211355207974; Thu, 29 Jan 2026 08:14:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vlUav-0000x0-0M; Thu, 29 Jan 2026 11:10:09 -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 1vlUaV-000096-S8 for qemu-devel@nongnu.org; Thu, 29 Jan 2026 11:09:44 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vlUaU-0006dA-4n for qemu-devel@nongnu.org; Thu, 29 Jan 2026 11:09:43 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-435a11957f6so972533f8f.0 for ; Thu, 29 Jan 2026 08:09:41 -0800 (PST) Received: from lanath.. (wildly.archaic.org.uk. [81.2.115.145]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e10edf62sm16762185f8f.13.2026.01.29.08.09.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jan 2026 08:09:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769702980; x=1770307780; 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=g7u4vFyrJCbAlZ8RKPYksrp2vL/fqFoBrZQZKiBf15A=; b=veu4X71E374WXEvR1FyrvPyjKNZUT45/dMAZGGqic7TakcPdIOMZobzDr2Sr3HW79f 5aeGCy4yvZYwX9g01OOdBTCr26EYzyNBd9/EJ0zZyd6N1/DX15euUIInPbuzcXYD8AxB 8VbgmTcE0KTOlXUYTlVGkKICat5+EwkiPxVM4WdH4avlUHvQQW0VrUnGJrcoLLl+6hTa 4lTuV9n3nKUeVAmm8kyQD1nbfxjcW+4xzo69cQkHMfYN9nKwarg7NC5dLlj0M+ZBzOU0 474L+uQWFEnKBEU25auH8c2XkDFI1HhJWkqbPyvYHUbzyZ3UaqvC2s9MF09Zq+r6gHtA A7nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769702980; x=1770307780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=g7u4vFyrJCbAlZ8RKPYksrp2vL/fqFoBrZQZKiBf15A=; b=ShivfiklzsNoxFyqh/OOgimAGmcAO7gi3g72eXlnDVQAMOit088o+IAH0mInJrtAjp zynqzeOhzGc1LgYnsn5TfaxgAFCIiXlv6kZgpFgvam8ND0tk1MjShrGC/JL7gfvHMHff rEzAxcF7xlA5cq90Hs2LNCuJOw5ki3EEqjhY4Ck0r2A9kkD+6/VRXUGX1RGQNvJlLfHr +AnuLKa/3lXDWFQbzv5VKV5BQaPcHQ7NuySKTSkKZG1quB/at7EIMUUf09XUMA8V14zR 1hUfuaW3AJYXdNBrxjynq3ha9cG7thxNz1P5Kl1Up2TCuO/uoSfrJYp6Pt1S2BrIE35F MlZw== X-Gm-Message-State: AOJu0YwfFN7Tgarg/H6vMY3X4SLvH5NjRn5na9UlZRto+SspvPToueLJ ORDbfT+LCRC1dwdjEo6bBv5/Z7GFhZP9z4WC1CUII+9Yd1sWVOO8K+JVQ7F7hV5oOWNp4PdogLo 3sJgbQmE= X-Gm-Gg: AZuq6aK1jPJWr+ChFNL8QRxDmnHsCCwOY5ODV5Bp3tR9Gri0bSeShL5v9AaARvF8h9i hCjyR414GPJj6s2VKOzYdq9bt4UsSmhPCc0Q8FrUPq6UnpTvc7CNqUsYjDYZl6Mf7PwL2gyOfYo eCkDtdyoXs4vzb1QHt9YKGAhKRzC3uqQ+XaIndmOZgqy/I/R8AKiEFvamjxNKsohh+E7yK4q3W1 jVOdHhiY6UNgyID4dAaL1AnHlm6XajVXUy+FrH9WybhFqNH61gGzq1XEvBpUISKpGqHFCjUZZI/ t/GPdBeePH7uupHBSZeWBVxnyYX406A7BpLYizMpjrSwBNnkLJhk/sF0qCduybGoar3c8Jxaq/0 pm1VHX0uAM73U7G0ET5iT1d/ybwWxPEq9/j2WB3HNNQNO50aCH/L/yI9z4f+cxrRd2izRPlv4Ib MZX7Kv3mZpqc1F/7szxLtZIjo1xEhBaw== X-Received: by 2002:a5d:5e01:0:b0:435:95c9:687a with SMTP id ffacd0b85a97d-435f3a6b95fmr178387f8f.4.1769702980220; Thu, 29 Jan 2026 08:09:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/43] hw/arm/smmuv3-accel: Implement get_msi_direct_gpa callback Date: Thu, 29 Jan 2026 16:08:51 +0000 Message-ID: <20260129160917.1415092-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260129160917.1415092-1-peter.maydell@linaro.org> References: <20260129160917.1415092-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.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 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1769703261354154100 Content-Type: text/plain; charset="utf-8" From: Shameer Kolothum Accelerated SMMUv3 instances rely on the physical SMMUv3 for nested translation (guest Stage-1, host Stage-2). In this mode, the guest Stage-1 tables are programmed directly into hardware, and QEMU must not attempt to walk them for translation, as doing so is not reliably safe. For vfio-pci endpoints behind such a vSMMU, the only translation QEMU needs to perform is for the MSI doorbell used during KVM MSI setup. Implement the callback so that kvm_arch_fixup_msi_route() can retrieve the MSI doorbell GPA directly, instead of attempting a software walk of the guest translation tables. Also introduce an SMMUv3 device property to carry the MSI doorbell GPA. This property will be set by the virt machine in a subsequent patch. Reviewed-by: Nicolin Chen Reviewed-by: Eric Auger Tested-by: Eric Auger Tested-by: Zhangfei Gao Reviewed-by: Jonathan Cameron Signed-off-by: Shameer Kolothum Message-id: 20260126104342.253965-18-skolothumtho@nvidia.com Signed-off-by: Peter Maydell --- hw/arm/smmuv3-accel.c | 10 ++++++++++ hw/arm/smmuv3.c | 2 ++ include/hw/arm/smmuv3.h | 1 + 3 files changed, 13 insertions(+) diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c index c125974d12..c6ee123cdf 100644 --- a/hw/arm/smmuv3-accel.c +++ b/hw/arm/smmuv3-accel.c @@ -393,6 +393,15 @@ static void smmuv3_accel_unset_iommu_device(PCIBus *bu= s, void *opaque, } } =20 +static uint64_t smmuv3_accel_get_msi_gpa(PCIBus *bus, void *opaque, int de= vfn) +{ + SMMUState *bs =3D opaque; + SMMUv3State *s =3D ARM_SMMUV3(bs); + + g_assert(s->msi_gpa); + return s->msi_gpa; +} + /* * Only allow PCIe bridges, pxb-pcie roots, and GPEX roots so vfio-pci * endpoints can sit downstream. Accelerated SMMUv3 requires a vfio-pci @@ -497,6 +506,7 @@ static const PCIIOMMUOps smmuv3_accel_ops =3D { .get_viommu_flags =3D smmuv3_accel_get_viommu_flags, .set_iommu_device =3D smmuv3_accel_set_iommu_device, .unset_iommu_device =3D smmuv3_accel_unset_iommu_device, + .get_msi_direct_gpa =3D smmuv3_accel_get_msi_gpa, }; =20 /* Based on SMUUv3 GPBA.ABORT configuration, attach a corresponding HWPT */ diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 7a32afd800..6ed9914b1e 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -1998,6 +1998,8 @@ static const Property smmuv3_properties[] =3D { * Defaults to stage 1 */ DEFINE_PROP_STRING("stage", SMMUv3State, stage), + /* GPA of MSI doorbell, for SMMUv3 accel use. */ + DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0), }; =20 static void smmuv3_instance_init(Object *obj) diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h index e54ece2d38..5616a8a2be 100644 --- a/include/hw/arm/smmuv3.h +++ b/include/hw/arm/smmuv3.h @@ -67,6 +67,7 @@ struct SMMUv3State { /* SMMU has HW accelerator support for nested S1 + s2 */ bool accel; struct SMMUv3AccelState *s_accel; + uint64_t msi_gpa; }; =20 typedef enum { --=20 2.43.0