From nobody Fri Nov 22 11:36:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1722341891; cv=none; d=zohomail.com; s=zohoarc; b=HfNFV1LrPE194+Mv4kn7JIpUpt5g+vPxQrUSSjnZFSkd51xWT0s7rqEwVSDJC6qxonw/VmlFhvWMkkyILljB+TWTE7RaomvjHsTXvyDFnfqThs7iYhuj/dsmTzoUjmWWcyMPzPDjX4GayaTyYm3gtByTd58QIHeEvTAU+2PdTWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722341891; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oJt36nY/JnhLYtPKhz3iINvaXsKib9chEKF3Ew8HPvA=; b=aNeJF0/ehHf+axFoYu/DTVilCciH6LI7wVC6ojvwc/pnUAH0HEyKyhYc91r0de6hzwotrZ0+J2ItGqLXe8RtTWB+rzzNmv4it8XgdvY+5owu15Yc9hu5dH42iD3NQzaVFY75iXK3SuBLtuM8AlEFTrdZ7jbXmemkX3akcGpTXo0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1722341891632120.61225043593538; Tue, 30 Jul 2024 05:18:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.767694.1178392 (Exim 4.92) (envelope-from ) id 1sYlnh-0002Vn-2K; Tue, 30 Jul 2024 12:17:57 +0000 Received: by outflank-mailman (output) from mailman id 767694.1178392; Tue, 30 Jul 2024 12:17:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sYlng-0002Vg-VZ; Tue, 30 Jul 2024 12:17:56 +0000 Received: by outflank-mailman (input) for mailman id 767694; Tue, 30 Jul 2024 12:17:55 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sYlnf-0002To-I4 for xen-devel@lists.xenproject.org; Tue, 30 Jul 2024 12:17:55 +0000 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [2a00:1450:4864:20::12d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bedecef6-4e6d-11ef-8776-851b0ebba9a2; Tue, 30 Jul 2024 14:17:53 +0200 (CEST) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-52efa9500e0so5499060e87.3 for ; Tue, 30 Jul 2024 05:17:53 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acab23132sm638852666b.27.2024.07.30.05.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 05:17:51 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bedecef6-4e6d-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1722341872; x=1722946672; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oJt36nY/JnhLYtPKhz3iINvaXsKib9chEKF3Ew8HPvA=; b=gj0GMDPMefbsZzysTD1QrbCVH+QeJdW5xDniYaAskjwijuAdV9qSlmThoVawnPtkV0 WTQzVAhJU0ey640icv8ea/KZxmpZ/DYZkK/gwb6jQgGfyUmvCG30X/ywILct3t2ohLN8 AmBxNAeaYU0YccGQ/4UF71jBlvj2owSpKys3c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722341872; x=1722946672; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oJt36nY/JnhLYtPKhz3iINvaXsKib9chEKF3Ew8HPvA=; b=OFxkoaBUhuqahRGM7/fsCVVjwfJXOL2yyrF4g0s2cLfjPSF17H8Rx3LnPyz/f5CQO9 Y5rbDBSh4bcpwcUiVUO5qtiggQmE8ElHIkXMHvKICh4TOj7RmPwCXemOWTT3lA6lzPJ7 5K8nr8tqmm0+Di5My9XBI0lmCnF6JhhZ9oU7ZukcJIEunXcYdS7IRHQrlRtTDZI7srfn Flvq4PKFtaeMVjEWn9dpkebd6m7ezmnxfCWpwgqWLA/Y3NWxpvAnMrlgo26FHq72GPXm J20zoFIDu3SnVtOG+9FerPLq4154aTLhU5YRDg/e+c7upOuhZR/Zh2xGbYrnyae5lThB 383g== X-Gm-Message-State: AOJu0YzmP0ZBJuWENwQNsBhBExhVPLNmd31SwHRN8jSgksEikuEShWAn PMv7xXjyoYd11OgdvXghqd3W6kJhgcNCABX5aojum1rYxuVERImAJHy/t13H3MYxd2A1YZ1tTBo n X-Google-Smtp-Source: AGHT+IFc0u2RQD+LmaEGt1f8CY8IZectWqgNjeIMQbR+0lneeB4GEhs0HWO/e7J129/P5FGGoChtTg== X-Received: by 2002:ac2:4f07:0:b0:52e:a60e:3a08 with SMTP id 2adb3069b0e04-5309b25aa12mr9326707e87.11.1722341872315; Tue, 30 Jul 2024 05:17:52 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH] x86/APIC: Drop APIC_BASE and use fix_to_virt() Date: Tue, 30 Jul 2024 13:17:49 +0100 Message-Id: <20240730121749.637879-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1722341892142116600 Right now the apic_mem_*() helpers only compile because sizeof(void *) =3D= =3D sizeof(long long). Switch to using fix_to_virt() which is a void *type. Also adjust the two places where the APIC/IO-APIC virtual address is render= ed in a printk(). No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 Split out of %L patch. --- xen/arch/x86/apic.c | 4 ++-- xen/arch/x86/include/asm/apic.h | 10 +++++++--- xen/arch/x86/include/asm/apicdef.h | 2 -- xen/arch/x86/io_apic.c | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index 6567af685a1b..7869c30e83f6 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -938,8 +938,8 @@ void __init init_apic_mappings(void) apic_phys =3D mp_lapic_addr; =20 set_fixmap_nocache(FIX_APIC_BASE, apic_phys); - apic_printk(APIC_VERBOSE, "mapped APIC to %08Lx (%08lx)\n", APIC_BASE, - apic_phys); + apic_printk(APIC_VERBOSE, "mapped APIC to %p (%08lx)\n", + fix_to_virt(FIX_APIC_BASE), apic_phys); =20 __next: /* diff --git a/xen/arch/x86/include/asm/apic.h b/xen/arch/x86/include/asm/api= c.h index a7798de02993..25faa54d9d10 100644 --- a/xen/arch/x86/include/asm/apic.h +++ b/xen/arch/x86/include/asm/apic.h @@ -51,12 +51,16 @@ const struct genapic *apic_x2apic_probe(void); =20 static inline void apic_mem_write(unsigned int reg, uint32_t v) { - *((volatile u32 *)(APIC_BASE+reg)) =3D v; + volatile uint32_t *addr =3D fix_to_virt(FIX_APIC_BASE) + reg; + + *addr =3D v; } =20 -static inline u32 apic_mem_read(unsigned int reg) +static inline uint32_t apic_mem_read(unsigned int reg) { - return *((volatile u32 *)(APIC_BASE+reg)); + volatile uint32_t *addr =3D fix_to_virt(FIX_APIC_BASE) + reg; + + return *addr; } =20 /* NOTE: in x2APIC mode, we should use apic_icr_write()/apic_icr_read() to diff --git a/xen/arch/x86/include/asm/apicdef.h b/xen/arch/x86/include/asm/= apicdef.h index b0790fad1cdb..49e29ec80156 100644 --- a/xen/arch/x86/include/asm/apicdef.h +++ b/xen/arch/x86/include/asm/apicdef.h @@ -117,8 +117,6 @@ /* Applicable to vectors, TPR, and PPR. */ #define APIC_PRIO_CLASS(v) ((v) & 0xF0) =20 -#define APIC_BASE __fix_to_virt(FIX_APIC_BASE) - #define MAX_IO_APICS 128 =20 extern bool x2apic_enabled; diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 7744b43f2414..772700584639 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -2596,8 +2596,8 @@ static void __init ioapic_init_mappings(void) } =20 set_fixmap_nocache(idx, ioapic_phys); - apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08Lx (%08lx)\n", - __fix_to_virt(idx), ioapic_phys); + apic_printk(APIC_VERBOSE, "mapped IOAPIC to %p (%08lx)\n", + fix_to_virt(idx), ioapic_phys); =20 if ( bad_ioapic_register(i) ) { --=20 2.39.2