From patchwork Tue Apr 2 12:55:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10881645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94D111708 for ; Tue, 2 Apr 2019 12:58:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FD95288C7 for ; Tue, 2 Apr 2019 12:58:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73CD4288DA; Tue, 2 Apr 2019 12:58:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 005F8288C7 for ; Tue, 2 Apr 2019 12:58:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hBIxG-0006kS-UZ; Tue, 02 Apr 2019 12:55:54 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hBIxF-0006kN-QA for xen-devel@lists.xenproject.org; Tue, 02 Apr 2019 12:55:53 +0000 X-Inumbo-ID: a321891c-5546-11e9-8964-7b46325eac03 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a321891c-5546-11e9-8964-7b46325eac03; Tue, 02 Apr 2019 12:55:49 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Tue, 02 Apr 2019 06:55:48 -0600 Message-Id: <5CA35BD00200007800223E49@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Tue, 02 Apr 2019 06:55:44 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH] x86/IO-APIC: consolidate / complete #define-s X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Drop redundant ones from apic.h. Add delivery mode mask. Use them in place of open coded hex numbers. Take the opportunity and modify a helper function's parameters to be just unsigned int. Also drop the bogus double underscore from its name, as it and all its callers get touched anyway. No functional change. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Reviewed-by: Wei Liu --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -410,7 +410,8 @@ void free_ioapic_entries(struct IO_APIC_ xfree(ioapic_entries); } -static void __modify_IO_APIC_irq (unsigned int irq, unsigned long enable, unsigned long disable) +static void modify_IO_APIC_irq(unsigned int irq, unsigned int enable, + unsigned int disable) { struct irq_pin_list *entry = irq_2_pin + irq; unsigned int pin, reg; @@ -432,25 +433,25 @@ static void __modify_IO_APIC_irq (unsign /* mask = 1 */ static void __mask_IO_APIC_irq (unsigned int irq) { - __modify_IO_APIC_irq(irq, 0x00010000, 0); + modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED, 0); } /* mask = 0 */ static void __unmask_IO_APIC_irq (unsigned int irq) { - __modify_IO_APIC_irq(irq, 0, 0x00010000); + modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_MASKED); } /* trigger = 0 */ static void __edge_IO_APIC_irq (unsigned int irq) { - __modify_IO_APIC_irq(irq, 0, 0x00008000); + modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_LEVEL_TRIGGER); } /* trigger = 1 */ static void __level_IO_APIC_irq (unsigned int irq) { - __modify_IO_APIC_irq(irq, 0x00008000, 0); + modify_IO_APIC_irq(irq, IO_APIC_REDIR_LEVEL_TRIGGER, 0); } static void mask_IO_APIC_irq(struct irq_desc *desc) @@ -571,7 +572,7 @@ set_ioapic_affinity_irq(struct irq_desc io_apic_write(entry->apic, 0x10 + 1 + pin*2, dest); data = io_apic_read(entry->apic, 0x10 + pin*2); data &= ~IO_APIC_REDIR_VECTOR_MASK; - data |= desc->arch.vector & 0xFF; + data |= MASK_INSR(desc->arch.vector, IO_APIC_REDIR_VECTOR_MASK); io_apic_modify(entry->apic, 0x10 + pin*2, data); if (!entry->next) --- a/xen/include/asm-x86/apic.h +++ b/xen/include/asm-x86/apic.h @@ -16,10 +16,6 @@ #define SET_APIC_LOGICAL_ID(x) (((x)<<24)) -#define IO_APIC_REDIR_VECTOR_MASK 0x000FF -#define IO_APIC_REDIR_DEST_LOGICAL 0x00800 -#define IO_APIC_REDIR_DEST_PHYSICAL 0x00000 - /* Possible APIC states */ enum apic_mode { APIC_MODE_INVALID, /* Not set yet */ --- a/xen/include/asm-x86/io_apic.h +++ b/xen/include/asm-x86/io_apic.h @@ -21,6 +21,7 @@ /* I/O Unit Redirection Table */ #define IO_APIC_REDIR_VECTOR_MASK 0x000FF +#define IO_APIC_REDIR_DELIV_MODE_MASK 0x00700 #define IO_APIC_REDIR_DEST_LOGICAL 0x00800 #define IO_APIC_REDIR_DEST_PHYSICAL 0x00000 #define IO_APIC_REDIR_SEND_PENDING (1 << 12)