From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99124C25B6B for ; Thu, 26 Oct 2023 08:35:34 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.623586.971559 (Exim 4.92) (envelope-from ) id 1qvvpn-0002J8-9x; Thu, 26 Oct 2023 08:35:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 623586.971559; Thu, 26 Oct 2023 08:35:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qvvpn-0002J1-7M; Thu, 26 Oct 2023 08:35:19 +0000 Received: by outflank-mailman (input) for mailman id 623586; Thu, 26 Oct 2023 08:35:18 +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 1qvvpm-0002Ir-Al for xen-devel@lists.xenproject.org; Thu, 26 Oct 2023 08:35:18 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 957b7d17-73da-11ee-9b0e-b553b5be7939; Thu, 26 Oct 2023 10:35:15 +0200 (CEST) Received: from mail-dm6nam11lp2169.outbound.protection.outlook.com (HELO NAM11-DM6-obe.outbound.protection.outlook.com) ([104.47.57.169]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 26 Oct 2023 04:35:04 -0400 Received: from SJ0PR03MB6423.namprd03.prod.outlook.com (2603:10b6:a03:38d::21) by PH7PR03MB6861.namprd03.prod.outlook.com (2603:10b6:510:15e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.11; Thu, 26 Oct 2023 08:35:00 +0000 Received: from SJ0PR03MB6423.namprd03.prod.outlook.com ([fe80::acf0:ce2b:1634:5aee]) by SJ0PR03MB6423.namprd03.prod.outlook.com ([fe80::acf0:ce2b:1634:5aee%6]) with mapi id 15.20.6933.011; Thu, 26 Oct 2023 08:34:59 +0000 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: 957b7d17-73da-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1698309315; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=3phdeXiAJ6AAHPlM5qYPmNM9r6GQ2LDYGU9ek1Iy4jE=; b=GxGkAwivaZJbtmGrTfkj1R5b3Ylsb8XgfpudCNUsTpnqYF10aYtzz4qv PNhc4iAlfhFZcUX5HfLiGaZtuR0Z04Mlan8FIt5HbytXtc1D9TsbfwXww QOkQvVv6qSjuQmj/xm7iiCDs7aTeJ3XdqHso+57BWXN3mxaNUu9RBNYGP c=; X-CSE-ConnectionGUID: vIMJivq3Qw+AW6JNEKRPbA== X-CSE-MsgGUID: Xfko9Dm0SXC40Y/eM8lzxw== X-IronPort-RemoteIP: 104.47.57.169 X-IronPort-MID: 129486066 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:XmuglKy231xJ465mdQl6t+cRxyrEfRIJ4+MujC+fZmUNrF6WrkUBx jRKXWvXPvyJZzGgf492aYXi/U8Ou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BFiVAd+O3b3Kzwptuup87?= X-Talos-MUID: 9a23:gV1p8gZAG783kOBThzHvg2BOMZ9T04/yUHFKnLBWv9uUKnkl X-IronPort-AV: E=Sophos;i="6.03,253,1694750400"; d="scan'208";a="129486066" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eaXY9ES/y00AkJ52vUBoe0U8ATn+H5PrK9ht3SaBSTT6ZLF8SL7JUHUe71ZfkMumIySMU+WKSSME51wG3ex3KPU0RdA61RARkvg+/1CPnYsvEULY5dOi3WLsC8r9aPHKIqcz1HUVoLz0Jels5BpD0Ch+X2KaMiTblIwMU4QsS21k6iPHtENofL2jSxywo9O877vlhEhZYaKK6Ne/tcWolfFBy02cjQKHdVVypo/VZq9zw+TDVl3rRqlFQI80y7Abj4GmAswKvLSeFAr9hj6++zwXr+qWaOf1LhERUbVRq8qisLpTFLpz9k7guwRh2asqJfPoTvFuWvdhU2g83eWJ9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=+KEtr1uQSl4gc7Rcv3Qw2AlIEg5hI2vh1pQO39tsbxs=; b=GI7WM7xfNEIEMF+CcxKV3cSGmEPuAJW2bu2f1gb+3EDPyrSLPrVFSlNxyGNGrKzYVKMumHSdTDYxLwVnIAMLOSNvAnm4DLbkhsHga5PXehCXM03iIgwtIBpvxuVH9OslmrYNXteGbg6/q9JSQ4Jp//lsmW2BLpS5XIMhSzCpepFIHIEZPWjWa7ZtzPXzfay0UdBvCP6vqjH/l37I3fFrPAAA3xOCggEsETjAFp3iJk1nsiKG/rBwCL4BJbGq8P6o6Y3bqP1Vy3cP2jGWsYAIhgy4Z724gx2Kj6a6s4mpGSSL4NKST8tHvfaigdn58ddkdQQTYH8wHugA6hw/4npMdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+KEtr1uQSl4gc7Rcv3Qw2AlIEg5hI2vh1pQO39tsbxs=; b=jy40cQTGN9BsfT7A4FjOHnABxQaLi0r32Zi26dUBZP+9QFFJfIwtykOS+KJ2FuC1j6A9Ejcz+2B7fc2lbNFujbkg4/ILNzL/8ceaDnWpg6QfElwPXWLcUEZWfqbxfBIUByCj0BG72mUhwfu9Ry2IX27SpFjBR2hna95gFHL0c1M= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; Date: Thu, 26 Oct 2023 10:34:56 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Jan Beulich Cc: "xen-devel@lists.xenproject.org" , Andrew Cooper , Wei Liu Subject: Re: [PATCH 4/7] x86: detect PIC aliasing on ports other than 0x[2A][01] Message-ID: References: <95129c04-f37c-9e26-e65d-786a1db2f003@suse.com> <27dd8f40-1ea6-1e7e-49c2-31936a17e9d7@suse.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <27dd8f40-1ea6-1e7e-49c2-31936a17e9d7@suse.com> X-ClientProxiedBy: LO0P123CA0006.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:354::8) To SJ0PR03MB6423.namprd03.prod.outlook.com (2603:10b6:a03:38d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR03MB6423:EE_|PH7PR03MB6861:EE_ X-MS-Office365-Filtering-Correlation-Id: 16ad3e80-cc4c-4692-adb6-08dbd5fe70f0 X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cxlbDmbYFL1l5KvEBEwsrmGw5ZjZu0MhebX5qTwBehoIU0b16u+7WKG8BBNFycZIYt3BCBFuBaRVj0374wkdhX2nqN5cTMbQ1AbUyTa++l7NtzqXRomeO8paQaRGTF5zcOYkl7D0YvZTDKinZt4rX5J6/eLfQwZJnzhBSpuYYHNfg3moAX6w8FinXP+G0A2vmg1Of+5yM+fLdPjDs/XcFJXofV3q8V4CjmSZAt+UZHoYsTyAORloh0TQO99+F3xyNjv9frR3iwlAzhpmBzV2tC8Tfr1IYKoKyG6lGbathYYehRR8jMufUeBQRp5oMDLFV8z8JA7XwrBegOdrFai98+WUvFElq8ybqFN8130vL+A77FE8HhEKORZVUP54DX85wp3N95fieJczsjTT2g3Qb8TNwECANr/AxZud9LAV/XCTRWhzf9tYVoBlTXRIgHrPsi1uePM7/oUAoYlzPIBtegxwH/cVLaIKgZVaVcCVediLaA5I5I4xxnjN2Yd7hesfW49SwnLFLbhoP/ohpJ2aegBN9NwyqgnHsiEEopzdjOoDTT1BGhpJ2B/NwUKlIKaB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR03MB6423.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7916004)(136003)(366004)(396003)(346002)(376002)(39860400002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(8936002)(8676002)(41300700001)(4326008)(2906002)(33716001)(5660300002)(9686003)(85182001)(82960400001)(6666004)(6512007)(6506007)(83380400001)(38100700002)(66946007)(86362001)(66556008)(26005)(6916009)(6486002)(478600001)(66476007)(54906003)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf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N/9kKlJyTzQZOMS9Ov74kEQvQISIgz1VP8bEOAQp7+QeIU58T9ZSOf+LlYm6Nbl6atUUQ9sZyHaZI6JMukreG3+hW/VJjjKEP/uon1pi0S45SJUG7ikXxIDxPevsPzYnNkRupTucRq4drjxpa+0XKZ4DabPVUIj8rDDWgcIQ2sLsBQ2YN45M7D9JLqcaRWp3+IsM/B62ypcjcKbci8NVxmhUpf9YHYmAMEpt2kjdlB6VKBUaRGP1ww9FiQKg8wYVEqwGW84fL8UVh2z5xCZTElg== X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16ad3e80-cc4c-4692-adb6-08dbd5fe70f0 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6423.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2023 08:34:59.8910 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eUCIM4LT+o3HCniK0F1KnFwHjXiGq7hWcWfRs+nH2DTALpfRO8YlWxwOW63p1t5GKndfsQp8wgwPRrYWhE/UtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR03MB6861 On Thu, May 11, 2023 at 02:06:46PM +0200, Jan Beulich wrote: > ... in order to also deny Dom0 access through the alias ports. Without > this it is only giving the impression of denying access to both PICs. > Unlike for CMOS/RTC, do detection very early, to avoid disturbing normal > operation later on. > > Like for CMOS/RTC a fundamental assumption of the probing is that reads > from the probed alias port won't have side effects in case it does not > alias the respective PIC's one. I'm slightly concerned about this probing. Also I'm unsure we can fully isolate the hardware domain like this. Preventing access to the non-aliased ports is IMO helpful for domains to realize the PIT is not available, but in any case such accesses shouldn't happen in the first place, as dom0 must be modified to run in such mode. > > Signed-off-by: Jan Beulich > > --- a/xen/arch/x86/dom0_build.c > +++ b/xen/arch/x86/dom0_build.c > @@ -479,7 +479,7 @@ static void __init process_dom0_ioports_ > int __init dom0_setup_permissions(struct domain *d) > { > unsigned long mfn; > - unsigned int i; > + unsigned int i, offs; > int rc; > > if ( pv_shim ) > @@ -492,10 +492,17 @@ int __init dom0_setup_permissions(struct > > /* Modify I/O port access permissions. */ > > - /* Master Interrupt Controller (PIC). */ > - rc |= ioports_deny_access(d, 0x20, 0x21); > - /* Slave Interrupt Controller (PIC). */ > - rc |= ioports_deny_access(d, 0xA0, 0xA1); > + for ( offs = 0, i = pic_alias_mask & -pic_alias_mask ?: 2; > + offs <= pic_alias_mask; offs += i ) I'm a bit lost with this, specifically: i = pic_alias_mask & -pic_alias_mask ?: 2 Which is then used as the increment step in offs += i I could see the usage of pic_alias_mask & -pic_alias_mask in order to find the first offset, but afterwards don't you need to increment at single bit left shifts in order to test all possibly set bits in pic_alias_mask? > + { > + if ( offs & ~pic_alias_mask ) > + continue; > + /* Master Interrupt Controller (PIC). */ > + rc |= ioports_deny_access(d, 0x20 + offs, 0x21 + offs); > + /* Slave Interrupt Controller (PIC). */ > + rc |= ioports_deny_access(d, 0xA0 + offs, 0xA1 + offs); > + } > + > /* Interval Timer (PIT). */ > rc |= ioports_deny_access(d, 0x40, 0x43); > /* PIT Channel 2 / PC Speaker Control. */ > --- a/xen/arch/x86/i8259.c > +++ b/xen/arch/x86/i8259.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -332,6 +333,55 @@ void __init make_8259A_irq(unsigned int > irq_to_desc(irq)->handler = &i8259A_irq_type; > } > > +unsigned int __initdata pic_alias_mask; Should this be __hwdom_initdata? I see it gets used in an __init function, so I guess this all permissions stuff is not really indented for a late hardware domain to use? > + > +static void __init probe_pic_alias(void) > +{ > + unsigned int mask = 0x1e; > + uint8_t val = 0; > + > + /* > + * The only properly r/w register is OCW1. While keeping the master > + * fully masked (thus also masking anything coming through the slave), > + * write all possible 256 values to the slave's base port, and check > + * whether the same value can then be read back through any of the > + * possible alias ports. Probing just the slave of course builds on the > + * assumption that aliasing is identical for master and slave. > + */ > + > + outb(0xff, 0x21); /* Fully mask master. */ > + > + do { > + unsigned int offs; > + > + outb(val, 0xa1); > + > + /* Try to make sure we're actually having a PIC here. */ > + if ( inb(0xa1) != val ) > + { > + mask = 0; > + break; > + } > + > + for ( offs = mask & -mask; offs <= mask; offs <<= 1 ) > + { > + if ( !(mask & offs) ) > + continue; > + if ( inb(0xa1 + offs) != val ) > + mask &= ~offs; > + } > + } while ( mask && (val += 0x0d) ); /* Arbitrary uneven number. */ > + > + outb(cached_A1, 0xa1); /* Restore slave IRQ mask. */ > + outb(cached_21, 0x21); /* Restore master IRQ mask. */ > + > + if ( mask ) > + { > + dprintk(XENLOG_INFO, "PIC aliasing mask: %02x\n", mask); > + pic_alias_mask = mask; > + } > +} > + > static struct irqaction __read_mostly cascade = { no_action, "cascade", NULL}; > > void __init init_IRQ(void) > @@ -342,6 +392,8 @@ void __init init_IRQ(void) > > init_8259A(0); > > + probe_pic_alias(); Could we use 8259A instead of pic in the function name and mask variable? Just so that it's consistent with how we refer to the PIC in other parts of the code. Thanks, Roger.