Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2267img; Tue, 19 Mar 2019 13:04:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQWb9LRdlqlHk1bgnLUkFvAx8G0vUiYx0mghG6XTJ2c/EuxPxtKdrB65b/x0GgTT3MtGYW X-Received: by 2002:a63:8143:: with SMTP id t64mr446363pgd.301.1553025889964; Tue, 19 Mar 2019 13:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553025889; cv=none; d=google.com; s=arc-20160816; b=IZ/hHh+CbsDYmTU5FvzHY95MJz+Xc7udxAm0cf7gmZi2phmbw7wlLCaSnIVzThRrir GnVlfPo3zJjEwkcJoxW/q01Y2s55i1LUlQ/BJNYYt8kAsF6ZruhPDDiGrcWy2tEgjPYO WUhl0Vg/GaSt/b8BrU4kh35G/1JNtiMmc9zM5pVuoouqlXuAHneFNlOmPZcX9GNQHIC9 9U3xhhMrKzWd3L8H+g6quB1VIiNmtjKWbpV1WTwVas2yF3YyjVeXh+ff34qRibmmGi3B lnbFJ0lP1rKOO7K8TflV5u/n4hbuu0Lmt3QsEJHrECjF0LJ6D2IAkldvDXBQ4vEgezEK UeVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=oHEicM3dZV97B5DK13pw8DnYpAUU9Yru694ZQ4jtq54=; b=1KmFW/EcobLaVrRacQgohKbhikGk3fT/bifsPei5Neq/lsJelsnlpnsNGk3uzNHd2t ETH68WLxVaUZSMsdvm5FLVZ3Xy3g1vGKUYAg32Fl2sfCwJBRNE1M6Ao/ENDWUj3evhap m8oIs+FiEqDEbZF4v/vAtxNJMPxoqLxnUbC+W5B7E8U7m7QwEOp6B8ZIJpGeM/QgBg+j kKFUrxcsCDkVEelZu30AvKlb8BPwirJ+HHZRZmtwiI+I8xe8LfY6WIA6CBRMd9hFj+K6 R13LhhsbWHILi5njCugavGN1iDcAsP60/hYwzbFi3FIiH5pJhym56Rrt0ejHUFAmCQfJ bZeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i63si13434964pfb.171.2019.03.19.13.04.34; Tue, 19 Mar 2019 13:04:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727116AbfCSUDb (ORCPT + 99 others); Tue, 19 Mar 2019 16:03:31 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:60580 "EHLO SMTP03.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726556AbfCSUDa (ORCPT ); Tue, 19 Mar 2019 16:03:30 -0400 X-IronPort-AV: E=Sophos;i="5.60,245,1549929600"; d="scan'208";a="81060873" From: Jennifer Herbert To: , , CC: Jennifer Herbert , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Subject: [PATCH] xen/pv: Add PV specific legacy_pic struct to expose legacy IRQs. Date: Tue, 19 Mar 2019 20:02:19 +0000 Message-ID: <1553025739-92245-1-git-send-email-jennifer.herbert@citrix.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ACPI tables doesn't always contain all IRQs for legacy devices such as RTC. Since no PIC controller is visible for a PV linux guest, under Xen, legacy_pic currently defaults to the null_legacy_pic - with reports no legacy IRQs. Since the commit "rtc: cmos: Do not assume irq 8 for rtc when there are no legacy irqs" by Hans de Goede (commit id: a1e23a42f1bdc00e32fc4869caef12e4e6272f26), the rtc now incorrectly decides it has no irq it can use, for some hardware. This patch rectifies the problem by providing a xen legacy_pic struct, which is much like the null_legacy_pic except that it reports NR_IRQS_LEGACY irqs. Signed-off-by: Jennifer Herbert --- arch/x86/xen/enlighten_pv.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index c54a493..7644bdf 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,7 @@ #include #include +#include #include #include #include @@ -1188,6 +1190,41 @@ static void __init xen_dom0_set_legacy_features(void) x86_platform.legacy.rtc = 1; } +/* + * The ACPI tables doesn't always contain all IRQ's for legacy devices + * such as RTC. Since no PIC controller is visible, we'd otherwise + * default to the null_legacy_pic - with no legacy IRQs. To allow drivers + * to use these IRQs despite this, provide a xen specific legacy_pic + * structure, which is noop, other then reporting NR_IRQS_LEGACY irqs. + */ + +static void xen_legacy_pic_noop(void) { }; +static void xen_legacy_pic_uint_noop(unsigned int unused) { }; +static void xen_legacy_pic_int_noop(int unused) { }; +static int xen_legacy_pic_irq_pending_noop(unsigned int irq) +{ + return 0; +} + +static int xen_legacy_pic_probe(void) +{ + pr_info("Using Xen legacy PIC\n"); + return nr_legacy_irqs(); +} + +struct legacy_pic xen_legacy_pic = { + .nr_legacy_irqs = NR_IRQS_LEGACY, + .chip = &dummy_irq_chip, + .mask = xen_legacy_pic_uint_noop, + .unmask = xen_legacy_pic_uint_noop, + .mask_all = xen_legacy_pic_noop, + .restore_mask = xen_legacy_pic_noop, + .init = xen_legacy_pic_int_noop, + .probe = xen_legacy_pic_probe, + .irq_pending = xen_legacy_pic_irq_pending_noop, + .make_irq = xen_legacy_pic_uint_noop, +}; + /* First C function to be called on Xen boot */ asmlinkage __visible void __init xen_start_kernel(void) { @@ -1267,6 +1304,8 @@ asmlinkage __visible void __init xen_start_kernel(void) xen_init_capabilities(); + legacy_pic = &xen_legacy_pic; + #ifdef CONFIG_X86_LOCAL_APIC /* * set up the basic apic ops. -- 1.8.3.1