Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4916609ybe; Mon, 16 Sep 2019 22:36:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqye1qR6n49YLktWZsX6Xgs4JXEwLlBRZdqDb580AvKdO/AqIVWaTYId3JKoRSJ7hw3zTutL X-Received: by 2002:a50:fa99:: with SMTP id w25mr2779813edr.259.1568698610172; Mon, 16 Sep 2019 22:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568698610; cv=none; d=google.com; s=arc-20160816; b=KwfQvcgSJKT92RchBxcr3KD+qPDclPM0/UyUHTgzVJjkpKLHFHNx5ofTjkP0pumb6d jGHr8cum8CYnOrTpA7XaccaVhtsHcQpzX090LcQQEwdMEH2wqQZdBkDOYJf/bEbMPiWZ spgt3e6OvCH+2q5eCpz6HT1MJ6MOu5rBTKduaPupkhHXGG9S4GiXjFWzdCIrFJcd/cya Mq+XX7EvSweqqOrcS1NMX5TK1qyRVTzKSZWfqOS7HYpIkqF23XsraElolTn6iqhQaHju VPEbkYlDzT63WXAyB1yVrNuS+MHksNtbx44Vul7ZeEo7tYK3AaQNAHphHkyiWsgNpaFC StyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=t3akh5zB3/Q+djFkh0fq8SlJSPrJIagY5XLdZNurwEE=; b=eXTcfHxB0TmgXBFG+BeSbwJtB7wi63ytPdY/kN0oNL4nR34v+MDZ/hFZ8R2IwMntgv xPrv5LCUkhs4H2xwfqcUUzKwq72mtv3Uq66v5VccRBJjqeoc2yJFhW7UhDuRl1mX0a2X EUKkkqhd9I1i9FM40fR/MNpRpelrYJq79ssTvFXnHvj7kKc6Pi9lRr2n3Sw7nNC/5LhK /mb+BU2iMH6wVuM0xbM78kcxRcW1O+l5+Kvw6jOmXfcbkKW+sPXyfL2CmdslPJ8pRqb9 TpNuwrGy0nQg71s1hWDbfiqR1yijra/VKjr87Ndlqn0RcluwEZJ1MO8tmJwz1x8t45mM NLlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9si677241eda.229.2019.09.16.22.36.25; Mon, 16 Sep 2019 22:36:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391109AbfIPTzy (ORCPT + 99 others); Mon, 16 Sep 2019 15:55:54 -0400 Received: from mga01.intel.com ([192.55.52.88]:35459 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732696AbfIPTzt (ORCPT ); Mon, 16 Sep 2019 15:55:49 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Sep 2019 12:55:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,513,1559545200"; d="scan'208";a="177152715" Received: from unknown (HELO debian-vmd.lm.intel.com) ([10.232.112.42]) by orsmga007.jf.intel.com with ESMTP; 16 Sep 2019 12:55:48 -0700 From: Jon Derrick To: Lorenzo Pieralisi Cc: Bjorn Helgaas , Keith Busch , , Subject: [PATCH 2/2] PCI: vmd: Fix shadow offsets to reflect spec changes Date: Mon, 16 Sep 2019 07:54:35 -0600 Message-Id: <20190916135435.5017-3-jonathan.derrick@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190916135435.5017-1-jonathan.derrick@intel.com> References: <20190916135435.5017-1-jonathan.derrick@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The shadow offset scratchpad was moved to 0x2000-0x2010. Update the location to get the correct shadow offset. Cc: stable@vger.kernel.org # v5.2+ Fixes: 6788958e ("PCI: vmd: Assign membar addresses from shadow registers") Signed-off-by: Jon Derrick --- drivers/pci/controller/vmd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 2e4da3f51d6b..a35d3f3996d7 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -31,6 +31,9 @@ #define PCI_REG_VMLOCK 0x70 #define MB2_SHADOW_EN(vmlock) (vmlock & 0x2) +#define MB2_SHADOW_OFFSET 0x2000 +#define MB2_SHADOW_SIZE 16 + enum vmd_features { /* * Device may contain registers which hint the physical location of the @@ -578,7 +581,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) u32 vmlock; int ret; - membar2_offset = 0x2018; + membar2_offset = MB2_SHADOW_OFFSET + MB2_SHADOW_SIZE; ret = pci_read_config_dword(vmd->dev, PCI_REG_VMLOCK, &vmlock); if (ret || vmlock == ~0) return -ENODEV; @@ -590,9 +593,9 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) if (!membar2) return -ENOMEM; offset[0] = vmd->dev->resource[VMD_MEMBAR1].start - - readq(membar2 + 0x2008); + readq(membar2 + MB2_SHADOW_OFFSET); offset[1] = vmd->dev->resource[VMD_MEMBAR2].start - - readq(membar2 + 0x2010); + readq(membar2 + MB2_SHADOW_OFFSET + 8); pci_iounmap(vmd->dev, membar2); } } -- 2.20.1