From patchwork Mon Mar 13 15:30:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 662690 Delivered-To: patch@linaro.org Received: by 2002:a5d:5602:0:0:0:0:0 with SMTP id l2csp585713wrv; Mon, 13 Mar 2023 08:32:18 -0700 (PDT) X-Google-Smtp-Source: AK7set8KrfKCm2tPmNlxtWE+iOSJlfaJBUoxjKPpfFTvfeiCfaXHSiFM4CzX7q1we8zNzSSoPGQM X-Received: by 2002:a05:622a:120a:b0:3bf:d238:6ca with SMTP id y10-20020a05622a120a00b003bfd23806camr58941349qtx.68.1678721538538; Mon, 13 Mar 2023 08:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678721538; cv=none; d=google.com; s=arc-20160816; b=qVrHoGKa/xrI4kz8KXhgWp5MQIRgrnzz9EkVk9Q/QCGgQuq2rz9I4Li7eX0YpzQVC8 HBPtLkSW6ACCmfLt4F6DOuinkNGEpGJs29UGlOjSN/5+0oV6gG3nHwFy16uv8CcYSyGT teDB7uds/7XM5gpcPY+DCpZxN/SyXQPzRgk+nOyH7Pt6aIaUD9mV5DGCDaSwDTsSVwc/ 0Ww1bYMzz+1CB1aaf4WtjlM3qm3Txp/a7BpgoSEN8uhvQ6rdFAxexWrEsjWqgvB13q9j 9zwj5wdCj+y1xRQk//rG3sRJLZX/YMz4Js+p6VjOY7h0onbH4paZVuFIVpsykRptAJLq /DcQ== 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:cc:to :from:dkim-signature; bh=N5CtT69IrDpUWsZ2cEH8Q0Ev0Hw6M0HQO47n0CmUmu0=; b=xSrVqhUPevGyTx3XvLdRD9Cz3iWXONp3xBjA10BnTAak5gWxBOwGfyPQzlu1y6QISY 6p3bsHx2PyWihPYMQkc59GzIZhAez28IYB/1jaDslyILiy+7u8+kE8l3AKiz22fOfLOv Lgs9uBMJ3UxvDR/OFMCsXI9F98gxHPebHC5r1zEFmdtqVch45OKP1OOkOupE3cuOYcJs /RDjops9vxvkaTJMtg+IrtRZIKbOGO4lqZQBZ9wC9Y3mJLkTfYcUYe94nJD/K842obim eZPnkWVa+KIk3kXSLDx5KxvCHXWwsxw4psTS7V02kpNjSkjMBfRtx+jzYQKoxbMXHV3E GdPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rjo4njV1; 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 b14-20020a05622a020e00b003bcdb90327csi24800qtx.512.2023.03.13.08.32.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Mar 2023 08:32:18 -0700 (PDT) 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=Rjo4njV1; 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 1pbk8V-0007N0-CO; Mon, 13 Mar 2023 11:30:55 -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 1pbk8U-0007Ms-Iv for qemu-devel@nongnu.org; Mon, 13 Mar 2023 11:30:54 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbk8S-0003fJ-WD for qemu-devel@nongnu.org; Mon, 13 Mar 2023 11:30:54 -0400 Received: by mail-wm1-x330.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso8184083wmo.0 for ; Mon, 13 Mar 2023 08:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678721451; 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=N5CtT69IrDpUWsZ2cEH8Q0Ev0Hw6M0HQO47n0CmUmu0=; b=Rjo4njV130v00sJkhialJyAt29GOMY5rwvNmQA6K5gfOBs7ej03QjycW84cOdFNzMa NPZD6xiJp4UuRLcwtRGurBwP256hwbMD3pFq0YKZCI9zywTC19Ux1AnqyQzwhBUR5Fzm 9guoPZzKDaIfpGTe1yFgtWh5jnMXamdq2HnLDmP5ijR1I1gVIs+z1seNmjRwZS9et1pS Z9EVi7WhTdJy9Ox58sqp8b4R1RLkeMLyH2Z/XsbFYwY67+tmlGzjaC/A+4Y7gwYz0a8V Y5V0KjQpj0ZzvD3PUfI6Uo9zzc3HTtEdnJZOGn6WUot5KPjBI4eVnP3jyE3EM1t02A8m 47qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678721451; 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=N5CtT69IrDpUWsZ2cEH8Q0Ev0Hw6M0HQO47n0CmUmu0=; b=bSj6o8zm2C2iMh5afAN2vy2HBvmeWtW9f/OVoMpBMlYxivtssWr+YtyQ+4hg94nlO9 C2y1UyQR5hgcg3E8hgTwwjv9p0O1TlEv1esypgjLK/bQGfTxEVT+E0o6uVVD1WvI1OEx ly0/INbUtCllsixNcuniBrXw+efCJ6OREUIpW2ykxfS35jJ/M3FdEKcbbUB0b2gSK9ge hglRmptctUUTV7vVaUxtTa7iQhclmSbmuhEFIzvocbBRukiIY/XmKaM9Z+2Zg1/VnuRG rWCZY8jRsaC/kDoElEol2zdrYDn1LqIYGaZbdcqUf89/9ld0zwVsbzSxXJrmr7neH3fw ybvw== X-Gm-Message-State: AO0yUKWqcvoBKMzbV9Ihw/NwFgQB5yAvq0O8LPV4SESlDBu+GKY4ym5A xJvwT3OdqZYHZY29Rn5nIenHsA== X-Received: by 2002:a05:600c:3c8f:b0:3ea:f6c4:5f3d with SMTP id bg15-20020a05600c3c8f00b003eaf6c45f3dmr11193646wmb.2.1678721451331; Mon, 13 Mar 2023 08:30:51 -0700 (PDT) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id i5-20020a1c5405000000b003ed246f76a2sm107993wmb.1.2023.03.13.08.30.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Mar 2023 08:30:51 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 3/6] hw/i386/amd_iommu: Remove intermediate AMDVIState::devid field Date: Mon, 13 Mar 2023 16:30:28 +0100 Message-Id: <20230313153031.86107-4-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 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org AMDVIState::devid is only accessed by build_amd_iommu() which has access to the PCIDevice state. Directly get the property calling object_property_get_int() there. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/acpi-build.c | 4 +++- hw/i386/amd_iommu.c | 2 -- hw/i386/amd_iommu.h | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index ec857a117e..a27bc33956 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2395,7 +2395,9 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker, const char *oem_id, /* IVHD length */ build_append_int_noprefix(table_data, ivhd_table_len, 2); /* DeviceID */ - build_append_int_noprefix(table_data, s->devid, 2); + build_append_int_noprefix(table_data, + object_property_get_int(OBJECT(&s->pci), "addr", + &error_abort), 2); /* Capability offset */ build_append_int_noprefix(table_data, s->capab_offset, 2); /* IOMMU base address */ diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 3813b341ec..19f57e6318 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1513,7 +1513,6 @@ static void amdvi_init(AMDVIState *s) /* reset device ident */ pci_config_set_vendor_id(s->pci.dev.config, PCI_VENDOR_ID_AMD); pci_config_set_prog_interface(s->pci.dev.config, 00); - pci_config_set_device_id(s->pci.dev.config, s->devid); pci_config_set_class(s->pci.dev.config, 0x0806); /* reset AMDVI specific capabilities, all r/o */ @@ -1581,7 +1580,6 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->mmio); sysbus_mmio_map(SYS_BUS_DEVICE(s), 0, AMDVI_BASE_ADDR); pci_setup_iommu(bus, amdvi_host_dma_iommu, s); - s->devid = object_property_get_int(OBJECT(&s->pci), "addr", &error_abort); msi_init(&s->pci.dev, 0, 1, true, false, errp); amdvi_init(s); } diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 79d38a3e41..5eccaad790 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -319,8 +319,6 @@ struct AMDVIState { uint64_t mmio_addr; - uint32_t devid; /* auto-assigned devid */ - bool enabled; /* IOMMU enabled */ bool ats_enabled; /* address translation enabled */ bool cmdbuf_enabled; /* command buffer enabled */