From nobody Mon Nov 25 03:44:14 2024 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2051.outbound.protection.outlook.com [40.107.236.51]) (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 5131A199FCC for ; Thu, 31 Oct 2024 09:17:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730366244; cv=fail; b=DCAb2GHkE41BjUvoO1DcQzAk8ngA6X4FVk4P8lBz+v0NnMymDISR3mqPxusKMOMmVzEiDA08wwq9XYwDjXnEirOoOa7SBr5ar5yqDr7KSxQabC9dzpE1srFaKhUYmH1OWdG3YSvFYco5tXyMEn8GWhdgQFE7neAgWrxPbohC0rM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730366244; c=relaxed/simple; bh=s6gqvh9MDsV60q0i55rnyPMj7ZtTOGM/Ilgl0hkZN4Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=flI4doN/rFuGXoug4im+bumwh0KsaLUuwnzFWy2w54CTFNvezSjf4/4NlYkoE9w/JYslrvUVVjfrHZ6EPDaz1CbINgSiPBE7+gOVPizpiXLOMTASpvAsGJavJZOQWjFKOHCh+2fpWrm1RsbJZ/8l0Zj+8fyDcijaJYV/GM9LT1c= 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=oQP2s+7n; arc=fail smtp.client-ip=40.107.236.51 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="oQP2s+7n" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BOBdrpuaEMi/88YDtg4dlfYsSJk/iEqoqMmRnCi7l1Dip8Lcgi/xnU9G0nwp1q/OhiLV7AWzakLuKvHtlxFlklfjW4CXquFJqonylZBIgsSqtcxtwCgMoaA8PTK8U7icWjS8jYukWekelHVW9bD+pWp7q/z2W5JzBdBkZWNP7dv/bCESJMJecNOa3I6BvEs9/Up/lzVZ8AFYeNwb465BwrSS2tGF5PkIQgR+GpV2pXSe1eIZTd3lEeYscSnC6NZhI6AJCqb2lyK4P/hilRDigEB193etpUyJSGQE075sk7IVcaJiQyahQXf27C5NnWsQoLnH2YBMP+YSms1UexO2KA== 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=JN16sgb4dfPYvWQ1H+ggOiOmzC7nt0KS3auUgYxkQ2M=; b=gz4x+mxu23vqYhNAs5FvbzyhedqZGl9Z46O70OmaT8rk6XPkYj/rsJ6n2VPgpzHloUSn1cNryPVJkZgcaaXKX6nrzf6EenyVYiIQEM1dNGZDE518A6A63Cf4ntOvpBIH04AGu7BpodQOMupvl60WvJVw9trobxL7aMVH6aCPRmHiRoHuwoJxCdhCwTPOcQl3KiWR7U9ZC7AM84ArtrBb+Hg0vpe9a7czO18W3zd3LBD0vvWE5gIS0/ndoZwRILStuAysR2mHgg20e+y9n2Ul1omyhy9jCdFeZjOhudRBaBg1ZHfsj8/DpYR54G9IHPDpYtusMyNyG089SGJZKi8Yhg== 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=JN16sgb4dfPYvWQ1H+ggOiOmzC7nt0KS3auUgYxkQ2M=; b=oQP2s+7njmk/oSguwH9BSskiss2xQnUx86elkculFVCcv12qGip/YJwdt4cRRi31G4FRT3bjE7T2TVrP2//eNtvMo6ZiJRsrmesx/QxkPXBrwGnfyFVF8yj9dKuF82iF1VVSEIET5mKID5QrgiSK/QEU2Lu9NdLCbZqiGmAjqL4= Received: from MW4PR04CA0066.namprd04.prod.outlook.com (2603:10b6:303:6b::11) by CY8PR12MB7337.namprd12.prod.outlook.com (2603:10b6:930:53::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Thu, 31 Oct 2024 09:17:18 +0000 Received: from CO1PEPF000042AE.namprd03.prod.outlook.com (2603:10b6:303:6b:cafe::37) by MW4PR04CA0066.outlook.office365.com (2603:10b6:303:6b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 09:17:18 +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 CO1PEPF000042AE.mail.protection.outlook.com (10.167.243.43) 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 09:17:18 +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 04:17:14 -0500 From: Suravee Suthikulpanit To: , CC: , , , , , , , , , Suravee Suthikulpanit Subject: [PATCH v7 10/10] iommu/amd: Remove amd_iommu_apply_erratum_63() Date: Thu, 31 Oct 2024 09:16:24 +0000 Message-ID: <20241031091624.4895-11-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031091624.4895-1-suravee.suthikulpanit@amd.com> References: <20241031091624.4895-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042AE:EE_|CY8PR12MB7337:EE_ X-MS-Office365-Filtering-Correlation-Id: e7aabb31-9ae8-4f05-ee3e-08dcf98cd183 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?u2g+ght3KmaRxwdVzdl+bi+q68B4V6fVaPbdKDHobSAPVi9i7bvPkSZJG2ae?= =?us-ascii?Q?hcZNQIn2217rGtmbOEmcyRV+mez94E6unj+BHBM20DOD38WWSdf+V1va+6YD?= =?us-ascii?Q?vjiQ2nYyvlL9SRqNlJlN7G383GWnUU8b9P9+LieuZoAvYjUtbI/4+24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/QsLd0erdCGXxuiN1isuV/sGOyzAiEv?= =?us-ascii?Q?8sAzShbewqrfYzX/ik1bgKJm1yetDnDY9Ji47EciAOd7wWu9Y1Jk2GZr9EzE?= =?us-ascii?Q?5DSlfh1VszXk0htkZyrufXGZ23zDU+HYPgJ7I4udAZPCg+y/No0RJX/ArWRI?= =?us-ascii?Q?34VYfhqgGLcZ/CX5+gzW9TfrAj/dqnhDDP3B9NmoRTB0r6FFyTAT/k5KNfg0?= =?us-ascii?Q?u/5W1O8SmRAyjlK21GyNI9Hjxz3u9w19TXaWJSp/xBoafjqpMaONivE2gEda?= =?us-ascii?Q?F974q+H6DmXgtXkuryrok5AjUvhhr3YPUz9CBvdpB5dB8CHQN0xY4Vn8yfBk?= =?us-ascii?Q?8otjjUBvkbxOdPb5OVNbrPH41umZoEBwLP3pty+OW44JNY+L9Q=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)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 09:17:18.3871 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7aabb31-9ae8-4f05-ee3e-08dcf98cd183 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: CO1PEPF000042AE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7337 Content-Type: text/plain; charset="utf-8" Also replace __set_dev_entry_bit() with set_dte_bit() and remove unused helper functions. Signed-off-by: Suravee Suthikulpanit Reviewed-by: Jason Gunthorpe --- 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 bfc61f7ed923..7004274bcdda 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 9f5bda23e45e..046628ba05a9 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; @@ -1179,17 +1147,6 @@ static bool search_ivhd_dte_flags(u16 first, u16 las= t) 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 @@ -2644,9 +2601,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 @@ -2674,8 +2631,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