From nobody Mon Nov 25 01:57:16 2024 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 025441CDFB4 for ; Thu, 31 Oct 2024 18:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730400225; cv=fail; b=nFIXXtj06JN91u1FgimyN5+hnVq7RkrkK/6fqtW0PLnL/VnPjpwiRK4hisKl5go5yUocjtDj5TtQuYaOJrtb4AUec0ImANkkXIhFXQazNzZ5qe/G8HNBc/I5f7yBvd3fFOqazqqRaOjsVHfgVXD0uAu2qwuTr+8tFoMdVk/aoeg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730400225; c=relaxed/simple; bh=xeRWW4zvUqOpuR1sVQhIMdgRFyuKd3lvLAJ/acdf0LI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Vb2mVSl/tMGdVcdSBh0C4UtomZFhizny5PeF9wiaG++kJbO7DxKCttHJxv2agS7yjzhO5ecJoo2tz6+1HC/K7dY2mcsgGwmfQb71rtePccNZdmm5MvjTMvudVhvsyBIYljzlp1un9PCnUWL6vohX5EpkHes302UnuTVv8znvxLE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Fp0Q9Lu0; arc=fail smtp.client-ip=40.107.94.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Fp0Q9Lu0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=muLgBFReyxBG0VooTCaB2du00i2lnoknTVUitgyflbtWgnMDPJnqX0SVO3eWOWO/g4S5v+EnlulNXkKcEQiXd99+qCVjA76V0HjucFdXjQmo/ZbDi2fwO2ubD5B97LVeVlvNVwnQtlUDOcvf+J4rfCRU9JwfplD6JhyBs/95N6Z1eBTMt259MHsOv4bbWexiD6vLFvg61xm/ejiFmoAxxE8qvX6t2BWMCw7ytKmFyvSCPHWMc0SfvY2dCS+tMT16vy64d30mRQtWs6yM1O7tmsT+zIPcQK9DHafS4AezHUluDWz7GQIpE21imRJB2k1a1YpyBWWDDj7rpnKEk7evHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uD4cARgDgWSDiPEKNunLs9w1VM/I4QbMZNF8q0H489I=; b=eBY3IvvFMgKCB/1SevtD2GpIhlGrADhn/3/z8aJvxJfW0Z2ECdMt+/WDIaV6BALI9W0tasY/J7lxp2uXtJa+7bMZsWyGxNWG5Cd4daZxamHryNVJSCJCXIZhHeAX4fIwD5ZHaUZlZ0z3R7FpBQgkzrFIoHChO/hvcUUs6/hZmy6xjImvsp7pPh46z5Uh9cTrHAxTaTYllqgKU9EfEb8qHrL0zM1rvr+V83QSHm8t9RsOyynSJx0ZNx38FIZVwKKB7Z4+wMU34pFacJp+flOYW5DgrY8r4SNQjT3V72MJeabUbVO9N7Xzwuq9dT4WFUkEdkTz5mkRJHMURckwCe3ehg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uD4cARgDgWSDiPEKNunLs9w1VM/I4QbMZNF8q0H489I=; b=Fp0Q9Lu0nFvD7mdtKviUjTYW7wh4nDcsyZdsgk/Llb4bi/veYO6wGb9TsPQjx+Qr8poUcM7S/uEit5AfM60s8r4uFPuTMRPrI51ir9eLEOMvSQL94SyGP7TQuaGDF9V2d5hpy6iRCAclJt0xcdDq1ER3IWGTv4vFjEXsD+MhwHg= Received: from CH0PR07CA0026.namprd07.prod.outlook.com (2603:10b6:610:32::31) by DS0PR12MB7512.namprd12.prod.outlook.com (2603:10b6:8:13a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Thu, 31 Oct 2024 18:43:39 +0000 Received: from CH2PEPF00000141.namprd02.prod.outlook.com (2603:10b6:610:32:cafe::c4) by CH0PR07CA0026.outlook.office365.com (2603:10b6:610:32::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.22 via Frontend Transport; Thu, 31 Oct 2024 18:43:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH2PEPF00000141.mail.protection.outlook.com (10.167.244.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 18:43:39 +0000 Received: from purico-ed03host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 31 Oct 2024 13:43:34 -0500 From: Suravee Suthikulpanit To: , CC: , , , , , , , , , Suravee Suthikulpanit Subject: [PATCH v8 10/10] iommu/amd: Remove amd_iommu_apply_erratum_63() Date: Thu, 31 Oct 2024 18:42:43 +0000 Message-ID: <20241031184243.4184-11-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031184243.4184-1-suravee.suthikulpanit@amd.com> References: <20241031184243.4184-1-suravee.suthikulpanit@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000141:EE_|DS0PR12MB7512:EE_ X-MS-Office365-Filtering-Correlation-Id: b4f7f344-3a8f-4ab2-7cef-08dcf9dbefb9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?SfcWFkeysRjH9Hztau43tGyc+QQ30p0sRaSCKqulHqy4zAxgFgHpWKGpru/7?= =?us-ascii?Q?wbkpLmvy7XeBRhrZsjFqTHC65Kw1f5ArdhMmKxUm54q77cd8y9XNL1DYAkN1?= =?us-ascii?Q?l+57ShrB9qNzX4EcyGcmfFi4SfyntE630obCz+LVFUdKE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APvLLv5JFxECmCziONegt3qYMWNUfUeJElMZp3Hj6WcQzE46t3zy?= =?us-ascii?Q?TZCCRIIzArZd6eaiF+Yeqa3BHL/TG58qcLMEGrBQ4PV9mFwAE2UFDFBZm58q?= =?us-ascii?Q?hqggDo/ZlDXubYpth7HEMgU2JHgn8gAmB/jw7IRNiV2sPK8MbghPsPJWJsP8?= =?us-ascii?Q?rg6wr1kmhyJjQ/8Xb7ra8ywnJ+u8i7OJvgN8QaU3Kd48EdgVbRI1nD8GtaOx?= =?us-ascii?Q?aqtgNnS1Kqoi83QIDoaagBlDjWUSRyXNtWsHEppm1afMaMEvjH+qiT9oGlOI?= =?us-ascii?Q?bh8sMlgDE2RzseIdwkqIklfCnITxyXJSB1t6cfOc0IxWtCD4uL5YH8uE38Y3?= =?us-ascii?Q?q5JdZfyzPP5qCPERpg5IFuTQCeHg+VQqRyAC2dUGxujEdwMzkg=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 18:43:39.3895 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4f7f344-3a8f-4ab2-7cef-08dcf9dbefb9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF00000141.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7512 Content-Type: text/plain; charset="utf-8" Also replace __set_dev_entry_bit() with set_dte_bit() and remove unused helper functions. Reviewed-by: Jason Gunthorpe Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/amd_iommu.h | 1 - drivers/iommu/amd/init.c | 50 +++-------------------------------- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h index 3bdceff30abf..ae7332995d8d 100644 --- a/drivers/iommu/amd/amd_iommu.h +++ b/drivers/iommu/amd/amd_iommu.h @@ -16,7 +16,6 @@ irqreturn_t amd_iommu_int_thread_evtlog(int irq, void *da= ta); irqreturn_t amd_iommu_int_thread_pprlog(int irq, void *data); irqreturn_t amd_iommu_int_thread_galog(int irq, void *data); irqreturn_t amd_iommu_int_handler(int irq, void *data); -void amd_iommu_apply_erratum_63(struct amd_iommu *iommu, u16 devid); void amd_iommu_restart_log(struct amd_iommu *iommu, const char *evt_type, u8 cntrl_intr, u8 cntrl_log, u32 status_run_mask, u32 status_overflow_mask); diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 6821ec7f3f8f..84c0fd483550 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -1001,38 +1001,6 @@ static void set_dte_bit(struct dev_table_entry *dte,= u8 bit) dte->data[i] |=3D (1UL << _bit); } =20 -static void __set_dev_entry_bit(struct dev_table_entry *dev_table, - u16 devid, u8 bit) -{ - int i =3D (bit >> 6) & 0x03; - int _bit =3D bit & 0x3f; - - dev_table[devid].data[i] |=3D (1UL << _bit); -} - -static void set_dev_entry_bit(struct amd_iommu *iommu, u16 devid, u8 bit) -{ - struct dev_table_entry *dev_table =3D get_dev_table(iommu); - - return __set_dev_entry_bit(dev_table, devid, bit); -} - -static int __get_dev_entry_bit(struct dev_table_entry *dev_table, - u16 devid, u8 bit) -{ - int i =3D (bit >> 6) & 0x03; - int _bit =3D bit & 0x3f; - - return (dev_table[devid].data[i] & (1UL << _bit)) >> _bit; -} - -static int get_dev_entry_bit(struct amd_iommu *iommu, u16 devid, u8 bit) -{ - struct dev_table_entry *dev_table =3D get_dev_table(iommu); - - return __get_dev_entry_bit(dev_table, devid, bit); -} - static bool __copy_device_table(struct amd_iommu *iommu) { u64 int_ctl, int_tab_len, entry =3D 0; @@ -1184,17 +1152,6 @@ static bool search_ivhd_dte_flags(u16 segid, u16 fir= st, u16 last) return false; } =20 -void amd_iommu_apply_erratum_63(struct amd_iommu *iommu, u16 devid) -{ - int sysmgt; - - sysmgt =3D get_dev_entry_bit(iommu, devid, DEV_ENTRY_SYSMGT1) | - (get_dev_entry_bit(iommu, devid, DEV_ENTRY_SYSMGT2) << 1); - - if (sysmgt =3D=3D 0x01) - set_dev_entry_bit(iommu, devid, DEV_ENTRY_IW); -} - /* * This function takes the device specific flags read from the ACPI * table and sets up the device table entry with that information @@ -2650,9 +2607,9 @@ static void init_device_table_dma(struct amd_iommu_pc= i_seg *pci_seg) return; =20 for (devid =3D 0; devid <=3D pci_seg->last_bdf; ++devid) { - __set_dev_entry_bit(dev_table, devid, DEV_ENTRY_VALID); + set_dte_bit(&dev_table[devid], DEV_ENTRY_VALID); if (!amd_iommu_snp_en) - __set_dev_entry_bit(dev_table, devid, DEV_ENTRY_TRANSLATION); + set_dte_bit(&dev_table[devid], DEV_ENTRY_TRANSLATION); } } =20 @@ -2680,8 +2637,7 @@ static void init_device_table(void) =20 for_each_pci_segment(pci_seg) { for (devid =3D 0; devid <=3D pci_seg->last_bdf; ++devid) - __set_dev_entry_bit(pci_seg->dev_table, - devid, DEV_ENTRY_IRQ_TBL_EN); + set_dte_bit(&pci_seg->dev_table[devid], DEV_ENTRY_IRQ_TBL_EN); } } =20 --=20 2.34.1