From nobody Mon May 6 10:29:32 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=1629117811; cv=none; d=zohomail.com; s=zohoarc; b=Muw2kIvMlT7oCR7eaRoiX7yzPbPxNeDEH7rtEA/SXcpa4RonKl5KPfN+2+z0DgJBP2h/mzADpgV6TT16GeicrqHK1b1y0i7c7OaL9QVv6tS4GeXXsKcaVGLCqq8uFrsdl4vq6ZdJo0ckj/qEVsEUjTDS2AShrHyRZnte3nrh9Ic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629117811; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=x6a6XxU9ZJBBNxIAcQdWlkC1eULFhylP2P23GLiK1Qs=; b=BvfHOVmzw8URi3jK3gVQHfKQyVmcEuq+l2IOiVLUYKjlPUU0d7D/cLHE5g5Z7AQk9ByaeCMvwTxrCqg0gQxZa2hupPPX8sWpZjcTY+ZIJW9wkmMGYc24GIm3ZNane4FQrN36ej8OaNbID+fUWwTr5j3QwS2x7xYnDeQjbcG1Ln4= 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 162911781119581.52645317916574; Mon, 16 Aug 2021 05:43:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.167326.305410 (Exim 4.92) (envelope-from ) id 1mFbxM-0007Q6-Hv; Mon, 16 Aug 2021 12:43:08 +0000 Received: by outflank-mailman (output) from mailman id 167326.305410; Mon, 16 Aug 2021 12:43:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mFbxM-0007Pz-EB; Mon, 16 Aug 2021 12:43:08 +0000 Received: by outflank-mailman (input) for mailman id 167326; Mon, 16 Aug 2021 12:43:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mFbxL-0007Ps-H1 for xen-devel@lists.xenproject.org; Mon, 16 Aug 2021 12:43:07 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b329adfb-bfab-4c87-b9a1-ccb317e811e4; Mon, 16 Aug 2021 12:43:06 +0000 (UTC) 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: b329adfb-bfab-4c87-b9a1-ccb317e811e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1629117786; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZRQsmpW7kZ2clhRw912uyvaL6Oimr2PVP4zb5KUA3o8=; b=FLpNqU894iPkngW8pz0wH2Oezo7CJAo1o1G/+KC4MnbruMBxFB6LFsTU PBsdbxJ9x59pdWAg9HFJoL/4UKWsX7T1yZJxDLY0kmgRlXLSjQ6OcTtZr FQTcDBzjBsL4qN0mFf1HkLZxjkG00edexBAxv4Szm0WkKnMuen6LDFWwC c=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: ruEs6ssYXbV2KJctjH9qmBpMyYdwBPXinglJxo6NGmWR+VOeCePUz3xXZ8qc7WWdi8+QGITlRC PbgE5DaaTjIxf1AkE7t1e0BBkBjs668HxPH+vGeWO3bcAR+AoTACjPcr5ryTiAzEw9YyIyQ2n7 F8Uaa336jyDRbnz3eyUc9ahLkv25fiP2G0D7lWdihALhHYeDwr57e/HEuYth4I+d8PiGg4GmOw gLlKMA6u1RI3mGGYY6yyvMS+FPgeD+5fEWhuaB3+iAiJ06WutPXO0FRKLEE2PlgSRCCMANtOEJ xY1vEhy4+Ab9Kx/bepAWVVfN X-SBRS: 5.1 X-MesageID: 50521113 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:A/NsrKiAl72j819BxH7FEcw5mnBQXtYji2hC6mlwRA09TySZ// rBoB19726StN9xYgBFpTnuAsm9qB/nmaKdgrNhWItKPjOW21dARbsKheCJrgEIcxeOkNK1vp 0AT0ERMrLN5CBB/KTH3DU= X-IronPort-AV: E=Sophos;i="5.84,324,1620705600"; d="scan'208";a="50521113" From: Kevin Stefanov To: Xen-devel CC: Kevin Stefanov , Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Kevin Tian Subject: [PATCH v3] x86/ioapic: Remove use of TRUE/FALSE/1/0 Date: Mon, 16 Aug 2021 13:42:55 +0100 Message-ID: <20210816124255.27405-1-kevin.stefanov@citrix.com> X-Mailer: git-send-email 2.25.1 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: 1629117814382100001 Also fix stray usage in VT-d. Suggested-by: Andrew Cooper Signed-off-by: Kevin Stefanov Reviewed-by: Jan Beulich Reviewed-by: Kevin Tian --- CC: Jan Beulich CC: Andrew Cooper CC: "Roger Pau Monn=C3=A9" CC: Wei Liu CC: Kevin Tian v2: * Also replace literal 1/0 v3: * Fix 1->false conversion error --- xen/arch/x86/io_apic.c | 38 +++++++++++++------------- xen/drivers/passthrough/vtd/intremap.c | 6 ++-- xen/drivers/passthrough/vtd/utils.c | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 58b26d962c..c3ad9efac8 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -289,7 +289,7 @@ static void __io_apic_eoi(unsigned int apic, unsigned i= nt vector, unsigned int p { /* If vector is unknown, read it from the IO-APIC */ if ( vector =3D=3D IRQ_VECTOR_UNASSIGNED ) - vector =3D __ioapic_read_entry(apic, pin, TRUE).vector; + vector =3D __ioapic_read_entry(apic, pin, true).vector; =20 *(IO_APIC_BASE(apic)+16) =3D vector; } @@ -300,28 +300,28 @@ static void __io_apic_eoi(unsigned int apic, unsigned= int vector, unsigned int p struct IO_APIC_route_entry entry; bool need_to_unmask =3D false; =20 - entry =3D __ioapic_read_entry(apic, pin, TRUE); + entry =3D __ioapic_read_entry(apic, pin, true); =20 if ( ! entry.mask ) { /* If entry is not currently masked, mask it and make * a note to unmask it later */ entry.mask =3D 1; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); need_to_unmask =3D true; } =20 /* Flip the trigger mode to edge and back */ entry.trigger =3D 0; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); entry.trigger =3D 1; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); =20 if ( need_to_unmask ) { /* Unmask if neccesary */ entry.mask =3D 0; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); } } } @@ -344,7 +344,7 @@ int save_IO_APIC_setup(struct IO_APIC_route_entry **ioa= pic_entries) return -ENOMEM; =20 for (pin =3D 0; pin < nr_ioapic_entries[apic]; pin++) - ioapic_entries[apic][pin] =3D __ioapic_read_entry(apic, pin, 1); + ioapic_entries[apic][pin] =3D __ioapic_read_entry(apic, pin, true); } =20 return 0; @@ -374,7 +374,7 @@ void mask_IO_APIC_setup(struct IO_APIC_route_entry **io= apic_entries) if (!entry.mask) { entry.mask =3D 1; =20 - ioapic_write_entry(apic, pin, 1, entry); + ioapic_write_entry(apic, pin, true, entry); } } } @@ -1047,7 +1047,7 @@ static void __init setup_IO_APIC_irqs(void) =20 SET_DEST(entry, logical, cpu_mask_to_apicid(TARGET_CPUS)); spin_lock_irqsave(&ioapic_lock, flags); - __ioapic_write_entry(apic, pin, 0, entry); + __ioapic_write_entry(apic, pin, false, entry); spin_unlock_irqrestore(&ioapic_lock, flags); } } @@ -1091,7 +1091,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int= apic, unsigned int pin, in /* * Add it to the IO-APIC irq-routing table: */ - ioapic_write_entry(apic, pin, 0, entry); + ioapic_write_entry(apic, pin, false, entry); =20 enable_8259A_irq(irq_to_desc(0)); } @@ -1203,7 +1203,7 @@ static void /*__init*/ __print_IO_APIC(bool boot) for (i =3D 0; i <=3D reg_01.bits.entries; i++) { struct IO_APIC_route_entry entry; =20 - entry =3D ioapic_read_entry(apic, i, 0); + entry =3D ioapic_read_entry(apic, i, false); =20 if ( x2apic_enabled && iommu_intremap ) printk(KERN_DEBUG " %02x %08x", i, entry.dest.dest32); @@ -1290,7 +1290,7 @@ static void __init enable_IO_APIC(void) int pin; /* See if any of the pins is in ExtINT mode */ for (pin =3D 0; pin < nr_ioapic_entries[apic]; pin++) { - struct IO_APIC_route_entry entry =3D ioapic_read_entry(apic, p= in, 0); + struct IO_APIC_route_entry entry =3D ioapic_read_entry(apic, p= in, false); =20 /* If the interrupt line is enabled and in ExtInt mode * I have found the pin where the i8259 is connected. @@ -1361,7 +1361,7 @@ void disable_IO_APIC(void) /* * Add it to the IO-APIC irq-routing table: */ - ioapic_write_entry(ioapic_i8259.apic, ioapic_i8259.pin, 0, entry); + ioapic_write_entry(ioapic_i8259.apic, ioapic_i8259.pin, false, ent= ry); } disconnect_bsp_APIC(ioapic_i8259.pin !=3D -1); } @@ -1841,7 +1841,7 @@ static void __init unlock_ExtINT_logic(void) if ( pin =3D=3D -1 || apic =3D=3D -1 ) return; =20 - entry0 =3D ioapic_read_entry(apic, pin, 0); + entry0 =3D ioapic_read_entry(apic, pin, false); clear_IO_APIC_pin(apic, pin); =20 memset(&entry1, 0, sizeof(entry1)); @@ -1854,7 +1854,7 @@ static void __init unlock_ExtINT_logic(void) entry1.trigger =3D 0; entry1.vector =3D 0; =20 - ioapic_write_entry(apic, pin, 0, entry1); + ioapic_write_entry(apic, pin, false, entry1); =20 save_control =3D CMOS_READ(RTC_CONTROL); save_freq_select =3D CMOS_READ(RTC_FREQ_SELECT); @@ -1873,7 +1873,7 @@ static void __init unlock_ExtINT_logic(void) CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); clear_IO_APIC_pin(apic, pin); =20 - ioapic_write_entry(apic, pin, 0, entry0); + ioapic_write_entry(apic, pin, false, entry0); } =20 /* @@ -2287,7 +2287,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int= irq, int edge_level, int a disable_8259A_irq(desc); =20 spin_lock_irqsave(&ioapic_lock, flags); - __ioapic_write_entry(ioapic, pin, 0, entry); + __ioapic_write_entry(ioapic, pin, false, entry); spin_unlock(&ioapic_lock); =20 spin_lock(&desc->lock); @@ -2476,7 +2476,7 @@ int ioapic_guest_write(unsigned long physbase, unsign= ed int reg, u32 val) rte.mask =3D 1; } =20 - __ioapic_write_entry(apic, pin, 0, rte); + __ioapic_write_entry(apic, pin, false, rte); =20 spin_unlock_irqrestore(&ioapic_lock, flags); =20 @@ -2529,7 +2529,7 @@ void dump_ioapic_irq_info(void) =20 printk(" Apic 0x%02x, Pin %2d: ", entry->apic, pin); =20 - rte =3D ioapic_read_entry(entry->apic, pin, 0); + rte =3D ioapic_read_entry(entry->apic, pin, false); =20 printk("vec=3D%02x delivery=3D%-5s dest=3D%c status=3D%d " "polarity=3D%d irr=3D%d trig=3D%c mask=3D%d dest_id:%0*= x\n", diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrou= gh/vtd/intremap.c index d0f70d90eb..01152f2006 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -427,7 +427,7 @@ unsigned int io_apic_read_remap_rte( ( (index =3D apic_pin_2_ir_idx[apic][ioapic_pin]) < 0 ) ) return __io_apic_read(apic, reg); =20 - old_rte =3D __ioapic_read_entry(apic, ioapic_pin, 1); + old_rte =3D __ioapic_read_entry(apic, ioapic_pin, true); =20 if ( remap_entry_to_ioapic_rte(iommu, index, &old_rte) ) return __io_apic_read(apic, reg); @@ -448,7 +448,7 @@ void io_apic_write_remap_rte( struct vtd_iommu *iommu =3D ioapic_to_iommu(IO_APIC_ID(apic)); int saved_mask; =20 - old_rte =3D __ioapic_read_entry(apic, ioapic_pin, 1); + old_rte =3D __ioapic_read_entry(apic, ioapic_pin, true); =20 remap_rte =3D (struct IO_APIC_route_remap_entry *) &old_rte; =20 @@ -468,7 +468,7 @@ void io_apic_write_remap_rte( __io_apic_write(apic, reg & ~1, *(u32 *)&old_rte); } else - __ioapic_write_entry(apic, ioapic_pin, 1, old_rte); + __ioapic_write_entry(apic, ioapic_pin, true, old_rte); } =20 static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *i= re) diff --git a/xen/drivers/passthrough/vtd/utils.c b/xen/drivers/passthrough/= vtd/utils.c index 4febcf506d..70add3cc8e 100644 --- a/xen/drivers/passthrough/vtd/utils.c +++ b/xen/drivers/passthrough/vtd/utils.c @@ -281,7 +281,7 @@ void vtd_dump_iommu_info(unsigned char key) for ( i =3D 0; i <=3D reg_01.bits.entries; i++ ) { struct IO_APIC_route_entry rte =3D - __ioapic_read_entry(apic, i, TRUE); + __ioapic_read_entry(apic, i, true); =20 remap =3D (struct IO_APIC_route_remap_entry *) &rte; if ( !remap->format ) --=20 2.25.1