Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1658316rdb; Thu, 7 Dec 2023 05:38:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7nahIkZnk6uWsU66OmIWlXVdVTWI6uOMuzeXGr4I5wM9c1taVKg6gJBcdywqgcXGB0kbI X-Received: by 2002:a05:6a00:1584:b0:6ce:6265:fc0d with SMTP id u4-20020a056a00158400b006ce6265fc0dmr2507295pfk.6.1701956316012; Thu, 07 Dec 2023 05:38:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701956315; cv=pass; d=google.com; s=arc-20160816; b=fa5V2pNlRoPYkJ+PL/b56lr1mt/ridYmxSoHHKrK6YqSFedI9fabS8Fp6btxoDc1t4 FXp/r+fdnBtnLlc0GsOvFKUuXVpc/rBVLPE4A9GIQFPVyQfK3XUy61aAivwgSf1H6/L/ 3az6a8fO0RBaxgFjKOXD+cw8SEuINlCGWYZYjKsC30hsZOzK7QoaFyEdXTz5k238fDge CnfdB/BCdarI6BYbV32pR0+nryFxkSbNiD7JWEu9hOWlA/o+hxP5mCPNLDRIDAOt+22e syttFVJ1M0HIFwOSwf1BOp2P6MyVO3//S1TiyQHoOSvMpOpgYZwJ82qfdoQJtM2PTUK0 jFQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CNkJqALxPIloVQQyRq9w66yUKQ75s1OxQOBMXkXLLOY=; fh=hRnlz9zcjjwzOj/PRtP1cmpz7R92GIS6+kOUelhEKLs=; b=Ip7+H2m5K4QKcoMeHgFll5XAhwWRMn/KChsh7evyI75MjIl8LoHPQrAJfCUT5gXgbq KVCnTfrwcg56HqvwRV1WGqQ9cKjBqVEJGEIveAsZKsHoipf6eIRCn4VzIOB69Tpo5toD IPedNT+0vzqMzfl2i8GAD30eCEe59h7lvYamfS+WB+5wCjtYPP0FuTX7L+X5DtI0VCT7 Z6GpHFlw06Gl1TtddUxPeH9zDHnnCCiII/jq9EJ4Oy/M2IKADJE0tS7rPq0HMad1vaVV 58IMFuddzwoR58A1Pbyv2Qbk1BoHhIEclLnfsRKTTBV/NnHYiUraVpSqQEbJkN/UcDwD yQvw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=RhCZKxKE; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h22-20020a63f916000000b005c203ad2343si1233987pgi.94.2023.12.07.05.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 05:38:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=RhCZKxKE; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 65DE38056480; Thu, 7 Dec 2023 05:38:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441947AbjLGNiY (ORCPT + 99 others); Thu, 7 Dec 2023 08:38:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441907AbjLGNiX (ORCPT ); Thu, 7 Dec 2023 08:38:23 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2045.outbound.protection.outlook.com [40.107.223.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4C4ED54; Thu, 7 Dec 2023 05:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j6btKgnBF2db8ZZxk47wou3rGEWdiWf/eh8ASiNB13C0E9Ioq0N4SwqX9Dc6YPj9qtHcNBSKnPc2EkT9CedmcWyXNHF6vvOuoH1BtfGL0CsJQ1p/oljZXL64FQVVK9gNAnBWEfr/HseQsh5Agh3djmBegFOlsCYXNzbxT0E19XTnFD4hYOUQXBGn/IA4rJFhC6miBNx+uwB4tBgHVSv0Or1+UHyR4bu0P72/rr++2aPRQXYvwzKbcuV19Ahe40trkQhLBGgzG3OH78oz7IbKoyJpOmNHR0uQ2CR7mILkCzusd7e1PZfdY0dhI70wuq6LHebbEkw6D5wqWdM77E9hFQ== 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=CNkJqALxPIloVQQyRq9w66yUKQ75s1OxQOBMXkXLLOY=; b=bpOZYbJb/5ieINi8OXkzkqCyG0yoPk3R2+JgdZ/y479itdbMucxSJiJ94gwX287Rv6Bb+9Q1ZR/MnoJwDjj38lTCWRLmsfvL5qQ+aXyCmoVCHT7QDblBi1xvEOXDfGI9Kz1Bx8DWqy0J37cg0kVioabBTpK0VJtOyOG+O5k3eUIGnucHsKJjCvKDfaR6XvjW/wCKNlrTXST7dkYKQc7Rntwr84xUUmBrkmqiDSxTWqliCxjpA2tN/puk3AD8asL796glCKlLDBW1Ux2U9DoGZVsCdxFZqJHKM6ovFMsjnk9066aUJAd5jxh7AyypnZUzSWKi3EcPxW0MhmzFdjQQYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CNkJqALxPIloVQQyRq9w66yUKQ75s1OxQOBMXkXLLOY=; b=RhCZKxKEg64gyT0b3j6M/kiF0VwmTEP3Vbzr65E4uYfcxx6SigYudTEJyaCC0JIzcyUs23wWsWO9XfD9Cxw5D3FVzaTKBLzmVlqPGSo1ckyEKpbWeQ0ujKipKI4KQ0vxsHgnBqtXdUHUZzu5ZHuli0Dfo97f6DAIQaKvaqc4Mc/2SJQEL28O2iQqvnFA+MCynuQJEv32XZDnMhTnUnzuyPe3lo/WaKJfsC9bdl45aR9r96MC7dQMVXoBmOd5k8B2LNGK8IIm2ygW5xN+B7zf9PIGxkCYYtvpx6t8Jm9xqigEjSpYqkdn+Wsy+9L6PmuWlFTxY0qx6C+h+e8d2LAMiw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by DS7PR12MB8289.namprd12.prod.outlook.com (2603:10b6:8:d8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Thu, 7 Dec 2023 13:38:26 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93%4]) with mapi id 15.20.7046.038; Thu, 7 Dec 2023 13:38:25 +0000 Date: Thu, 7 Dec 2023 09:38:25 -0400 From: Jason Gunthorpe To: Lorenzo Pieralisi Cc: Catalin Marinas , Marc Zyngier , ankita@nvidia.com, Shameerali Kolothum Thodi , oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, will@kernel.org, ardb@kernel.org, akpm@linux-foundation.org, gshan@redhat.com, aniketa@nvidia.com, cjia@nvidia.com, kwankhede@nvidia.com, targupta@nvidia.com, vsethi@nvidia.com, acurrid@nvidia.com, apopple@nvidia.com, jhubbard@nvidia.com, danw@nvidia.com, mochs@nvidia.com, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/1] KVM: arm64: allow the VM to select DEVICE_* and NORMAL_NC for IO memory Message-ID: <20231207133825.GI2692119@nvidia.com> References: <20231205164318.GG2692119@nvidia.com> <20231205194822.GL2692119@nvidia.com> <20231206150556.GQ2692119@nvidia.com> <20231206153809.GS2692119@nvidia.com> <20231206164802.GT2692119@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BL1PR13CA0254.namprd13.prod.outlook.com (2603:10b6:208:2ba::19) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|DS7PR12MB8289:EE_ X-MS-Office365-Filtering-Correlation-Id: d83d53c0-7edb-445a-1e14-08dbf729c9f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +PLS9XJa84XgId/39fpR6mjL4zlOYkDm6EAMMNlxDWH27P/4vPSLDV6SzEl8RCXk7+9FZmLvNgYQVxzcfIajAo6TsFYJSDO3A3HgZ2dvuH8xhIDJZIU6dHpk/kY/Z4wxagzZxFiJjBrpRCVKkJv1rxfIxA8jxfwxHEg/vXIU5kbV+qktZXreKR98OmKY9LJdqX5zx9ew/FgSbHIoCr8K8ZVIHiAYUQO5NPM5wwtdZEd8Nb/a+1nffPNqX+ZTFyv4aIY8QnTO8Oz/cZoGB5083Og9afox625RegVqaT5Saz+lwDf0H/z3l4JLAinb/cIo6LYzdlcAe+jesEIz9yN0e3mdZC7JooXo1LoZhoptqLvBB76UJ72r6WaaKLSDhFrdjikxDWGvXANdC6fV368szwllxc4ROk819oSYjyr/W7dem2VBdZo5J1IvkibhYDLNpBMscBwFWI0Ji/IDJ/gWhyLvd9tvudONLsY/i4Rb7cBNCarVpJILhbDXxo9gqVffm5rMSJc+xKNExsBA+zJwc8ZmM7bVtJA6OCunbnduI1DwPtqKGBJ4F+S/xddqlnQh X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(39860400002)(366004)(136003)(346002)(396003)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(4326008)(54906003)(316002)(83380400001)(5660300002)(7416002)(6486002)(6916009)(66946007)(66476007)(66556008)(8936002)(2906002)(478600001)(8676002)(6506007)(6512007)(2616005)(26005)(41300700001)(33656002)(1076003)(36756003)(38100700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?p2lInPG7+HvFJ/QV4Rl9Pvm7Y77r9O7E/I6Xf3z4jkELZr+qOxGlbQqqrYUf?= =?us-ascii?Q?qN/HoMOdLX2facLQDoFUJ2Bo7dGXS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orsbEMJiBgmWzbgX1s+Zqz9GxlEkw+IfAAT2Na1oQybWd1xsRcRBbkeif?= =?us-ascii?Q?sLp5dsmmlYVvSYeLi7hWh+pvQ0ZrIl6/EedEIQA0ZcYJJpf9oiSk4ojB3RWC?= =?us-ascii?Q?ey0SWOvL1CHcJLW9V2dmigk1/t8BYmT3leVnAgzVYRDFes5MrsmOFdAYkB9F?= =?us-ascii?Q?ojibFeU1lir5DdfctevO/ZYxevXt0dRDivdRRiTD7okp9nD09qi2093eMKQ1?= =?us-ascii?Q?LG6M/u8RtCQaG1vN5g25HMeg2j7JT8NusM8hzcBwO7ZDZXFBbBrcIdHkP9rf?= =?us-ascii?Q?IEn2Ph5SCwcFneU7uAEpbNNCrbV2qB1t+QUZw7OBmJIhDITgP5+1xjiZDZXq?= =?us-ascii?Q?bbArTDONijhOFf3GvlvpbN5r/H9jOuHTnvkjEdO5K9iu2DZ0XAND5WyaaGXO?= =?us-ascii?Q?RCddAqhzS5SP4gJsXxyjyoZSWrUmJVOKJurhQs8SlrNxZSoZpDtDzJvXfnBx?= =?us-ascii?Q?bURMvRKkz1qBRvzL7aUGiIIRV8Ohz1BcciEftkC+D/wRG/Ir03sdNtl/2kjp?= =?us-ascii?Q?XZ4HmO65cOqTUKl5X5Ah0rdJmnyUYnAwPk9wBQToI7IeXbFb2CyB6Waid60I?= =?us-ascii?Q?Eo4S7T6CxLmsPtX69uakGzJWvMNCaVHVOcuRc+7H?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d83d53c0-7edb-445a-1e14-08dbf729c9f7 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2023 13:38:25.8836 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3BvC8BnVt6ea0X/JCkPQw/WlLk6usmY0nQ6sEn+u20QWJ+uAlP6Jw9+VPKEYuDM2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8289 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 07 Dec 2023 05:38:34 -0800 (PST) On Thu, Dec 07, 2023 at 11:13:52AM +0100, Lorenzo Pieralisi wrote: > > > What about the other way around - would we have a prefetchable BAR that > > > has portions which are unprefetchable? > > > > I would say possibly. > > > > Prefetch is a dead concept in PCIe, it was obsoleted in PCI-X about 20 > > years ago. No PCIe system has ever done prefetch. > > > > There is a strong incentive to mark BAR's as prefetchable because it > > allows 64 bit addressing in configurations with bridges. > > If by strong incentive you mean the "Additional guidance on the > Prefetchable Bit in Memory Space BARs" in the PCI express specifications, > I think it has been removed from the spec and the criteria that had to be > met to implement it were basically impossible to fulfill on ARM systems, > it did not make any sense in the first place. No, I mean many systems don't have room to accommodate large 32 bit BARs and the only real way to make stuff work is to have a 64 bit BAR by setting prefetchable. Given mis-marking a read-side-effect region as prefetchable has no actual consequence on PCI-E I would not be surprised to learn people have done this. > I agree on your statement related to the prefetchable concept but I > believe that a prefetchable BAR containing regions that have > read side-effects is essentially a borked design unless at system level > speculative reads are prevented (as far as I understand the > implementation note this could only be an endpoint integrated in a > system where read speculation can't just happen (?)). IMHO the PCIe concept of prefetchable has no intersection with the CPU. The CPU chooses entirely on its own what rules to apply to the PCI MMIO regions and no OS should drive that decision based on the prefetchable BAR flag. The *only* purpose of the prefetchable flag was to permit a classical 33/66MHz PCI bridge to prefetch reads because the physical bus protocol back then did not include a read length. For any system that does not have an ancient PCI bridge the indication is totally useless. Jason