Message ID | 20240718124932.114121-2-papaluri@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2075.outbound.protection.outlook.com [40.107.92.75]) (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 7210654645 for <kvm@vger.kernel.org>; Thu, 18 Jul 2024 12:49:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721306996; cv=fail; b=edrf3Szqru27x1Df4qoMiSNTXRJPCCo79vXVmTDYIGxLX8ZPvSjIoWDRXVlpDESNsvuetUAVgGU74alI5cihUMguTNrsG0JIcbZxQ9qIAhHPLdzMOgCZCMJggZRuApR90mhpgXDbIgOLcYozhOIwaxcAihF6yC01DXwwTUs0iZI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721306996; c=relaxed/simple; bh=1iX6YLNIFSEh7KMPj9kMom2gHAfLIsQmq3Tx5oDIh3g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AMvw3t5Dtpt6icJ+ftO3+pZHj6VSxK+d7IpKWkqxxUuTKy+UnZ8ELpsgZVmSa1HPFudYC4a1QW9MPV2/NLLyxbvkZyK5CvJMvEfCicEqotVkpabSYTM9VIeg1oaHV46As++S5pXbJkoJgAjaK2wWtr/++U8v3vDT2PwdvhXu87Q= 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=sqpfBb+m; arc=fail smtp.client-ip=40.107.92.75 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="sqpfBb+m" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S8ovq7bOtzRt/U1pSVYQNNteY6BCpKnHSG9o4v1pV7BZsKX+FyTBXrih1wEXXfz9XfkJTZKInUOUcMNS9eT3Yokt5efhuDeBvBGKmPUcq8ZmEzca8TjB/WdNTFLzK2/Egy7HV+8ENLkoUNQ2G7WOI1NsAaexNRxqMsITGYQAexDncxNGQPmjwsNbWZ1sESnvDhA178uya08ERnBTTQQfdWFkbubDQKeKFLjYMQmwXT33pYHZ6ubCiKHNIPEajSk4EfM4QvYvDVKIDExlSOBqdY6fYwSKepL54X2YoFYq8ZlxnADSqm5x7nVUh90RYRN8RRWp3aWeq6EFOO5ohQ5WhQ== 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=A3RoF+vzRQjPy6w2YlDtR/acKhHExPTvmZXWrXlEWsI=; b=mxaJLBVYqGzHloa2c5iSarrDv1Zqsvfu4D3o/dLjXiH0+V3pthHvmSf/81er0AfH800NwnkydVCkgXjoECG741Uac8/Z32oc6D/aw/dRIR9SIea9m0HpKXYZXlMzgs36q7pwsGCvAv1eZZ1OVPpviJYF4er1R2ldMmZAldt5I18w+tSwacuLRK/jBC/t5Z/F5ZXzMNjcA/tcjhuXuLxgomh16tBX3dCNjxtU72ZvWiqaZSH2CjcBYyAQiBF/w2j8AzR0lVhCrnH4Zf4i/735WeZ7M8qguvtYJnx873NE/Wgs7cTs6pA8lO5OIPrB199MTo7G0U7+R+MgyW71xwR2hw== 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=A3RoF+vzRQjPy6w2YlDtR/acKhHExPTvmZXWrXlEWsI=; b=sqpfBb+mtZEwu7sVUj0h54IZGFX66fEwaFMcF495LxUTY5OGyagYHB7aIvj1zPccyxQ++gPCIlOl1r2jBJgf3VYiifUOAQA9pSRGhdraDIKfpmB8qwCtcqAMsVe5FFMtkAscckkGxBuXrq0LXXGO6WxAijXiQTQUfCR4KK48G/U= Received: from BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) by IA1PR12MB7591.namprd12.prod.outlook.com (2603:10b6:208:429::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.18; Thu, 18 Jul 2024 12:49:51 +0000 Received: from BN2PEPF000044A7.namprd04.prod.outlook.com (2603:10b6:208:32e:cafe::99) by BLAPR03CA0137.outlook.office365.com (2603:10b6:208:32e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16 via Frontend Transport; Thu, 18 Jul 2024 12:49:51 +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 BN2PEPF000044A7.mail.protection.outlook.com (10.167.243.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7784.11 via Frontend Transport; Thu, 18 Jul 2024 12:49:51 +0000 Received: from ethanolx16dchost.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, 18 Jul 2024 07:49:50 -0500 From: Pavan Kumar Paluri <papaluri@amd.com> To: <kvm@vger.kernel.org> CC: Paolo Bonzini <pbonzini@redhat.com>, Sean Christophersen <seanjc@google.com>, Michael Roth <michael.roth@amd.com>, Tom Lendacky <thomas.lendacky@amd.com>, Pavan Kumar Paluri <papaluri@amd.com>, "Kim Phillips" <kim.phillips@amd.com>, Vasant Karasulli <vkarasulli@suse.de> Subject: [kvm-unit-tests PATCH v2 01/16] x86/apic: Use common library outb() implementation Date: Thu, 18 Jul 2024 07:49:17 -0500 Message-ID: <20240718124932.114121-2-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240718124932.114121-1-papaluri@amd.com> References: <20240718124932.114121-1-papaluri@amd.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: <kvm.vger.kernel.org> List-Subscribe: <mailto:kvm+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:kvm+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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: BN2PEPF000044A7:EE_|IA1PR12MB7591:EE_ X-MS-Office365-Filtering-Correlation-Id: 1bfb8d7d-8a19-4759-8196-08dca7281d7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ULnwD0tB8bUv1VmniNlEWriaGUNZGpG?= =?utf-8?q?07QS5HG42U8tnjXmgtJTmNUtRGjp10Fd3ekERpBOsbrs9Rzn5WyYjJk+pfv5pcX/U?= =?utf-8?q?qkfU3xg/ij+1hQBuj1FjLum8SmpGvYfdKBFofWo8aNSig4QBf83NykIVhVHJS6Pmy?= =?utf-8?q?Zv1xneAlAsypFxi67tyt8zbVJti/hhAjvthsLDHSg8fWQmafkMLp0iBIG10yJU4IM?= =?utf-8?q?+GW7hpEf1lZ5p0x5rcH1DYghPwYMIB7MFDtrldMcsuwUbyBoBugZjs74JwMpe60Br?= =?utf-8?q?tLi6RHAXQ7zBOmLLw69AekHmzShxh9wYIKhYfQra8OLYILD4SW78LzSWQPy7G4mbb?= =?utf-8?q?rrqmJDUDOVeU//Iwtr7y9fi5yF3aFb/8zf7747UoZANtoxbBFBkC9ANMcCzMEmEdP?= =?utf-8?q?1R7fw59iYEkIqcqFhiwxOM3TwlQa5RtzPMZjlhh3ud/Ia5TU4D4/F1s0Wz6bLGdqe?= =?utf-8?q?zYJpq6cLQyC/479MJoR2Pb9UL/8aF5bEMquxaZxfqR4cvIqqQARzTvpLLU9xLmRpo?= =?utf-8?q?5wtqKHE5a+kEIY7tPDgIWnwkUWqCk0NmX+RqHPCxmvOyxXCIEX3G0xQgoIbTT6nzz?= =?utf-8?q?20pMX+uKsCKLAhVURBYKaEaKksxzG1GYcd7e3e27+428MqebMq9qa0nusJhP0Wavt?= =?utf-8?q?t5wVse+q2xEmBTOr/2EhNT/bCvGuGld+VhEn4jkR1mASq30EtTes65w8cE8syVRcc?= =?utf-8?q?rjQDUxacUXb+83bohVz/UjyMF4BsLLoqzf/MTRbHm4CGUC4eLi4TySsOpHx11aI0J?= =?utf-8?q?ku3Rq79fuTDpIZcMuzvGAt/CPdPtqszneBfNDjJwGxrBrdvIIcBgmlKIYlAKQ6b8X?= =?utf-8?q?2sugGVKVdcC2f5OToBqMv69jqjLTZLftcU5G9c5wG+lhYYBwqKoKjilXIRYfvi97N?= =?utf-8?q?2fzyvqXFW12zPAjCH0Ywy0Q6m6LxvjRvpyTX2hYFsAclS3AKwZfY3LKxp8BYlZhJT?= =?utf-8?q?BCvNPUjoDZmoxqQMWYARJ97wzwfSPZAradl6d1KgMjyap05ldEx8v3o4LPWKAm6qx?= =?utf-8?q?0vSXBbxVQXx0ecA8+V7BCvFYoA7RTymbDx2qNr04u2FeDJ895yqI7bE2FToq6icF5?= =?utf-8?q?PZetg5dafd1+ETuKGZX3Ry/uQO47Jviae4NK50UWSaRgdvo4ys/Eru1nb1r6u+LLV?= =?utf-8?q?cpoBXNQjHA4gBTFs1GwB0/jMK4ANDZ/QWcN6EuKuMb66ZuYtQ+9UqWsrSYYzlM4TX?= =?utf-8?q?YSQ3YLOhRwdxi35LPxgxhr5ghQvGtTAClhhLByoSp8xhWgANtdFV7a62ccuDQFovK?= =?utf-8?q?n/3XRngRHeQwvdapce4dBSc/L/F5B1tVJv99VkPtzfq+viMqmK+BlvDV3f+/DEL9h?= =?utf-8?q?yZQ2XuBI+FxlPhjG1XewHsvVMdrGVWgCCxMsSQlPgQrvezJYpMmqGaNoDmFOIFIou?= =?utf-8?q?TFNPDPKRbhy?= 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)(1800799024)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2024 12:49:51.4306 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1bfb8d7d-8a19-4759-8196-08dca7281d7b 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: BN2PEPF000044A7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7591 |
Series |
Introduce SEV-SNP support
|
expand
|
diff --git a/lib/x86/apic.c b/lib/x86/apic.c index 0d15147677dd..bbc2d8ae85b1 100644 --- a/lib/x86/apic.c +++ b/lib/x86/apic.c @@ -4,6 +4,7 @@ #include "processor.h" #include "smp.h" #include "asm/barrier.h" +#include "asm/io.h" /* xAPIC and I/O APIC are identify mapped, and never relocated. */ static void *g_apic = (void *)APIC_DEFAULT_PHYS_BASE; @@ -23,11 +24,6 @@ static struct apic_ops *get_apic_ops(void) return this_cpu_read_apic_ops(); } -static void outb(unsigned char data, unsigned short port) -{ - asm volatile ("out %0, %1" : : "a"(data), "d"(port)); -} - void eoi(void) { apic_write(APIC_EOI, 0); @@ -232,7 +228,7 @@ void set_mask(unsigned line, int mask) void set_irq_line(unsigned line, int val) { - asm volatile("out %0, %1" : : "a"((u8)val), "d"((u16)(0x2000 + line))); + outb((u8)val, (u16)(0x2000 + line)); } void enable_apic(void)
Remove the redundant local outb() implementation in favour of using the common outb() implementation defined in lib/x86/asm/io.h, and convert set_irq_line() to not open-code the out instruction. Verfied no changes in assembly output for all three callsites, tested, no functional changes were observed. The rationale behind this change is that, support for SNP tests that are introduced later will need apic sources to include common library io code and if we don't remove apic's local outb() implementation, then we get the following compilation conflicts: In file included from lib/x86/apic.c:7: lib/x86/asm/io.h:30:14: error: conflicting types for ‘outb’; have ‘void(unsigned char, short unsigned int)’ 30 | #define outb outb | ^~~~ Signed-off-by: Pavan Kumar Paluri <papaluri@amd.com> --- lib/x86/apic.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)