From patchwork Sat Mar 15 09:14:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 873871 Delivered-To: patch@linaro.org Received: by 2002:a5d:4308:0:b0:38f:210b:807b with SMTP id h8csp1105293wrq; Sat, 15 Mar 2025 02:19:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXgbchd5m17KJ2eju9UrwuBQFWHTSK5N4jc/ec1fYD0/bqFf7vPmffSRvTyhH4N3AqHOpMCbQ==@linaro.org X-Google-Smtp-Source: AGHT+IEwAI6mUphteKKCTq2pQ5fD4C1SU3deNpRuJbhF2kvvAxB03Ipfl72r/j/ldSokA6FDuyyM X-Received: by 2002:ac8:5891:0:b0:472:1225:bd98 with SMTP id d75a77b69052e-476c81e04a5mr101192661cf.50.1742030347603; Sat, 15 Mar 2025 02:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742030347; cv=none; d=google.com; s=arc-20240605; b=DlZvgFEXN1m4kFAcq5YiLEtANGoytPk3iJn23m28DvMPClAxjQNjlRYbFbKhE/HnBU WAueVnRxXo748r8lPkGWzz+qdTyFHdsdIq1ZQv79SQSs6XM+IE8e7f1gaYFAKldrhVXn cVJalMx0S0jsEhaCnXFdB+dE723pQ2sLvcgxV1unvfO2bZTFIbqMAP7iPzGppGgjg2ke 6f60RUJU4/4ReXnB73jHyYlKZ4plrGZlKHmhQZUqQSKuAf8upXl52V38G/v9oeCS9uKE 5xEiJqfbzA/yW75nxCxiGu6STgF51G6Ab/K7T/9f+Ykqb/ppMHj5FSEdpE9so1S+8a2u gEvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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; bh=wTVpB6jwsO1yf6q8ZPXxBbLHQJqaI8zdvAlU/724+bk=; fh=RkVaduC9mSS2s8S4opwaBgxzh946Y+Bi0zKymkK8x08=; b=IEZe8V2GnJEnjJgjLSPEJm7and4/7+joczVDMfsDmabHBi+LKjBbxVvGnMFnT/uBpo cEIIPK1PDiGzjIcrtOIMukmOOxS3MR2AfAQdGnck+VH5OvfN9yVS/NchOP02UVgHIi/Q oD8Gzjyqz2OZtpo+Elbvg+I8noLmhVLlUoQH/c5eI5J8H7UqdHTKEYEJuTJFisk5HZ+G uCQ8I9P4klniLbSrhegEmJUMwNIkJvC7yjKKeK6WZJFG4ADNFhxaw8GnK874c4tGCSBR 1R1SPlVx9Msah4IgZtHV+/J97vg9USSMXt7KrTIEK1r1IetZ9VYSK0BrsOiM8Jykn11j 81mg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-476bb7da18csi52867681cf.206.2025.03.15.02.19.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Mar 2025 02:19:07 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ttNcK-00031Z-Bx; Sat, 15 Mar 2025 05:15:40 -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 1ttNcG-0002wb-5W; Sat, 15 Mar 2025 05:15:38 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ttNcD-0007yQ-UE; Sat, 15 Mar 2025 05:15:35 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id CE557FFBBD; Sat, 15 Mar 2025 12:13:45 +0300 (MSK) Received: from gandalf.tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with ESMTP id D6D4A1CAD56; Sat, 15 Mar 2025 12:14:39 +0300 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id AF7B355A42; Sat, 15 Mar 2025 12:14:39 +0300 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S . Tsirkin" , Michael Tokarev Subject: [Stable-7.2.17 12/27] hw/i386/amd_iommu: Explicit use of AMDVI_BASE_ADDR in amdvi_init Date: Sat, 15 Mar 2025 12:14:23 +0300 Message-Id: <20250315091439.657371-12-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 From: Philippe Mathieu-Daudé By accessing MemoryRegion internals, amdvi_init() gives the false idea that the PCI BAR can be modified. However this isn't true (at least the model isn't ready for that): the device is explicitly maps at the BAR at the fixed AMDVI_BASE_ADDR address in amdvi_sysbus_realize(). Since the SysBus API isn't designed to remap regions, directly use the fixed address in amdvi_init(). Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20230313153031.86107-3-philmd@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 6291a28645a0656477bc5962a81b181e6a99487c) Signed-off-by: Michael Tokarev diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index d94c0f9bfb..e6da60fc15 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1514,9 +1514,9 @@ static void amdvi_init(AMDVIState *s) /* 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, - s->mmio.addr & ~(0xffff0000)); + AMDVI_BASE_ADDR & ~(0xffff0000)); pci_set_long(s->pci.dev.config + s->capab_offset + AMDVI_CAPAB_BAR_HIGH, - (s->mmio.addr & ~(0xffff)) >> 16); + (AMDVI_BASE_ADDR & ~(0xffff)) >> 16); pci_set_long(s->pci.dev.config + s->capab_offset + AMDVI_CAPAB_RANGE, 0xff000000); pci_set_long(s->pci.dev.config + s->capab_offset + AMDVI_CAPAB_MISC, 0);