From nobody Tue Feb 10 01:34:45 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=1678721512; cv=none; d=zohomail.com; s=zohoarc; b=ND0l+4sIlk68LDHPIGt3VKoAlj01UhrFuQ2g75FIAqV6FFdlJVRhIjTuguZZj2vYEpkJPSr5tIuTJ8Yy3jw58kzKnGrlzszRWyBNnP8N4lDMqs+Rgkk8gDykcMS7KIwWP0jD89v213KfutcXUU+fbbL4EUb7lwuUdXwQD9FXgp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678721512; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=68P9o5ttMw0mQyQty14BLwj3xt8sf0BeuG7uOwOm8GE=; b=P5gj4Iedy0iCdfMBB5vNrjkU8l1+QBjIVUZEf0XFLfExsgNkHSa7mPwE+nc3rEKUwMSMcOro/V/1shObiSmOONlf+jz8dl+zfQmQ8JE7Il+17KQYF8fjmOSEeL7Q14r0a8opGyWMzk0naV+nWFJvrDNEkzichVFHT6yPjQWB2Ho= 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 1678721512341322.8786740924994; Mon, 13 Mar 2023 08:31:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbk8d-0007Nr-D1; Mon, 13 Mar 2023 11:31:03 -0400 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 1pbk8Z-0007NV-UG for qemu-devel@nongnu.org; Mon, 13 Mar 2023 11:31:00 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbk8Y-0003fw-31 for qemu-devel@nongnu.org; Mon, 13 Mar 2023 11:30:59 -0400 Received: by mail-wm1-x32a.google.com with SMTP id p16so8298155wmq.5 for ; Mon, 13 Mar 2023 08:30:57 -0700 (PDT) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id y23-20020a1c4b17000000b003daffc2ecdesm80332wma.13.2023.03.13.08.30.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Mar 2023 08:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678721457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=68P9o5ttMw0mQyQty14BLwj3xt8sf0BeuG7uOwOm8GE=; b=RqUdSL9QoTykLoyL0fG2E8r5QiAhnqa3dCQ9XIYs10zVCWdOoKwRKRNs5zuqqCV4Jg ur1iv4Ll8pxSMQ5LvUJe92ukHNot0l7bMhi/c23+F0fosm8bSng12gu/xueScQ2cX0tu PhMa5Gk0UnPdyRbCp+083dXjjNb52PncBoMAMKR0YfMrAbyXHXOSDwKQXRKm2JY5ZVNh dPqRdZst0HKiL/sFYLZzCw7NTWGWFzZeZi0q0xd1FmzDbY905LTL2ex4bL+6EQVWCfhr P3TpOrzUVpkq5kfULVaFmlPAFBnr1wBBe8vQluYStnOJZqtZb3/Fn9uh6w0TI8Yq1Iqc MSwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678721457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=68P9o5ttMw0mQyQty14BLwj3xt8sf0BeuG7uOwOm8GE=; b=XXzTC0luLRZv8WF/By6D5w2xD0X7qqm0V3OAoxrRdzbOwJznGZE7O8JnPM72dyK9yw k+yPJl3ej2f0oD+QhQW09blxIClTOBpmxcou7x85WnOpcOwor2g2LdRSCmHjAtIzfzY1 zStBT22sK35X+/LsIVmxonE3O+medN7OxkBLhcIHG+OHv3GGRV7NSfVZI4yFtaul9CM5 DCE6bcQhgp25GfPfemoD6Z0f9SEnvOuktcgiUh6RtkJWGffE3ap7Ou71sEu7TmO15ajQ yEDRYFza7CiUfTZqI/dtJmyCFY/Y+FbLXXEuQs3lOC2yxyHGqzvfxwfrvgnPbSJhagzf /88A== X-Gm-Message-State: AO0yUKUnHrx6dscbREs6raGVipbUBZCUa8nG9aiDHhc+HsyHhdEcAdeW UtH/tEcIrxOD36bt/s6vcwdPfg== X-Google-Smtp-Source: AK7set9Jw/s0lRtEA2OxLgJ7dsJ1R+emMyhUsJJb3v9clVHXlX2mOXRhNQmE+Fd+swkxuObAJDOKuw== X-Received: by 2002:a05:600c:3acb:b0:3eb:2e2b:ff3d with SMTP id d11-20020a05600c3acb00b003eb2e2bff3dmr11267919wms.20.1678721456700; Mon, 13 Mar 2023 08:30:56 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Wei Huang , qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Ani Sinha , Peter Xu , Igor Mammedov , "Michael S. Tsirkin" , Paolo Bonzini , Marcel Apfelbaum , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 4/6] hw/i386/amd_iommu: Move capab_offset from AMDVIState to AMDVIPCIState Date: Mon, 13 Mar 2023 16:30:29 +0100 Message-Id: <20230313153031.86107-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230313153031.86107-1-philmd@linaro.org> References: <20230313153031.86107-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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: 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: 1678721525715100001 The 'PCI capability offset' is a *PCI* notion. Since AMDVIPCIState inherits PCIDevice and hold PCI-related fields, move capab_offset from AMDVIState to AMDVIPCIState. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/acpi-build.c | 2 +- hw/i386/amd_iommu.c | 14 +++++++------- hw/i386/amd_iommu.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index a27bc33956..7f211e1f48 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2399,7 +2399,7 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linke= r, const char *oem_id, object_property_get_int(OBJECT(&s->pci), "ad= dr", &error_abort), 2); /* Capability offset */ - build_append_int_noprefix(table_data, s->capab_offset, 2); + build_append_int_noprefix(table_data, s->pci.capab_offset, 2); /* IOMMU base address */ build_append_int_noprefix(table_data, s->mmio.addr, 8); /* PCI Segment Group */ diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 19f57e6318..9f6622e11f 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1516,15 +1516,15 @@ static void amdvi_init(AMDVIState *s) pci_config_set_class(s->pci.dev.config, 0x0806); =20 /* reset AMDVI specific capabilities, all r/o */ - pci_set_long(s->pci.dev.config + s->capab_offset, AMDVI_CAPAB_FEATURES= ); - pci_set_long(s->pci.dev.config + s->capab_offset + AMDVI_CAPAB_BAR_LOW, + pci_set_long(s->pci.dev.config + s->pci.capab_offset, AMDVI_CAPAB_FEAT= URES); + pci_set_long(s->pci.dev.config + s->pci.capab_offset + AMDVI_CAPAB_BAR= _LOW, AMDVI_BASE_ADDR & ~(0xffff0000)); - pci_set_long(s->pci.dev.config + s->capab_offset + AMDVI_CAPAB_BAR_HIG= H, + pci_set_long(s->pci.dev.config + s->pci.capab_offset + AMDVI_CAPAB_BAR= _HIGH, (AMDVI_BASE_ADDR & ~(0xffff)) >> 16); - pci_set_long(s->pci.dev.config + s->capab_offset + AMDVI_CAPAB_RANGE, + pci_set_long(s->pci.dev.config + s->pci.capab_offset + AMDVI_CAPAB_RAN= GE, 0xff000000); - pci_set_long(s->pci.dev.config + s->capab_offset + AMDVI_CAPAB_MISC, 0= ); - pci_set_long(s->pci.dev.config + s->capab_offset + AMDVI_CAPAB_MISC, + pci_set_long(s->pci.dev.config + s->pci.capab_offset + AMDVI_CAPAB_MIS= C, 0); + pci_set_long(s->pci.dev.config + s->pci.capab_offset + AMDVI_CAPAB_MIS= C, AMDVI_MAX_PH_ADDR | AMDVI_MAX_GVA_ADDR | AMDVI_MAX_VA_ADDR); } =20 @@ -1557,7 +1557,7 @@ static void amdvi_sysbus_realize(DeviceState *dev, Er= ror **errp) if (ret < 0) { return; } - s->capab_offset =3D ret; + s->pci.capab_offset =3D ret; =20 ret =3D pci_add_capability(&s->pci.dev, PCI_CAP_ID_MSI, 0, AMDVI_CAPAB_REG_SIZE, errp); diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 5eccaad790..1c0cb54bd4 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -308,6 +308,7 @@ typedef struct AMDVIAddressSpace AMDVIAddressSpace; /* functions to steal PCI config space */ typedef struct AMDVIPCIState { PCIDevice dev; /* The PCI device itself */ + uint32_t capab_offset; /* capability offset pointer */ } AMDVIPCIState; =20 struct AMDVIState { @@ -315,7 +316,6 @@ struct AMDVIState { AMDVIPCIState pci; /* IOMMU PCI device */ =20 uint32_t version; - uint32_t capab_offset; /* capability offset pointer */ =20 uint64_t mmio_addr; =20 --=20 2.38.1