Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1062267rdb; Fri, 20 Oct 2023 07:29:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJ3NQ/5ra11p04/nZhqRKqHnCZb39JPvJYvdTfKzIQqQR7zSsEPAhCiuze/zLP0TEKKRlX X-Received: by 2002:a05:6a21:998a:b0:161:3120:e865 with SMTP id ve10-20020a056a21998a00b001613120e865mr2104125pzb.52.1697812163976; Fri, 20 Oct 2023 07:29:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697812163; cv=pass; d=google.com; s=arc-20160816; b=WVmRlRGv8ohtXNYdP2GmaoF3wxxKd4l8rjpnDNXOTNEYEfPoWZwvSE/VdVrwEO0FPI HqlYy8AniLXZ15Yhdw3g73ypiYu0548HW5SCu+H92ggVA5kseTj440XexxCzSOUCEJ8n zH9zwNS63aicAUyXJMFHmxXxTwtAf7ik9e/XisrqrULfPcW1DROrHSAhFQ8/OcHYXRL5 x+YJwXLNFJvVxTvhxy9owNHUr/ISeySME8/mqDdNo0gC9hzAllyrU5d3FhNqHio0A6o4 d9G4PoEcf5sgPKwKmQILIZRytbiY+0iO9yJr1IPHuGPtrWegia4dTRdBg+XIfip8VtYV g0fA== 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=j31BCaDIQXsXSkWq9Xib7jbddEm8iZVJcnUPR674CYM=; fh=fKJetD8saDy98mftfHua+TxGiHmiQWL5j0hpp91TMfc=; b=mRltNxLcDZC9FX6vAlT2y4G00Ix8EaEl+KJH0P0N9jPFZ37t4T2ThxACMhGilJR+nv rgk5jT1p2vknBR4OHdE2GlSWIlWmReT1TEyU+9f+7lHidroI0A4rKXEC+JTsinEtNOCp pDZEY/XDmDxV1j/0I1/iZgXr0h8k0aM2mxuaKxyY/UmH8E7ufq4mYc15eEKlgO2QJZG1 wa8jmbcqzORs5xAKhMI8J1Ita+eNi2nCAKmnPd6WMEq1IUTOthn/P1UIWXOMIJ8lG9ex kJ1HUMfG/syDPFygXY1dgMJmcziVSvJ1sg1HX99+u1ng15NYFr3Xg9xd3dO0y0WSwU1w hkhA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=sRSWh7io; 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:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id x11-20020a634a0b000000b005b82de74216si1911576pga.901.2023.10.20.07.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 07:29:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=sRSWh7io; 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:8 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 fry.vger.email (Postfix) with ESMTP id CEA158074CE2; Fri, 20 Oct 2023 07:29:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377523AbjJTO3J (ORCPT + 99 others); Fri, 20 Oct 2023 10:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377496AbjJTO3I (ORCPT ); Fri, 20 Oct 2023 10:29:08 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2052.outbound.protection.outlook.com [40.107.244.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EADCED53 for ; Fri, 20 Oct 2023 07:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hehMfuqgl1xh+pOSOseCWXKrcSQvmbBhlyxM1+hHZZl/CQAMITwJjEnOxoD0zzOVGarGTVvyYgIrnoxrEonzY2LDsmFiC0CigqPNpdg/hs5hKsWyiOY5rAGwPs8M265zX85q+qWtqlaqtn4Xsp4tvoj30z7kmACDeo2yKJbeNPoevok11qdrWPEXGTMx+65qk3cziroVSm0+ZjssxH56+gCVcbm/hvSwOWdMEpTge6hT/F3YDSL8tNvwlR4A+NMLzNT2LWSP9DqQgJqJl4q0C1eXZUrtAsMFNVSZK7X0H9oRtofhQHUNbfHS3s5WMwN50EKpC7pY8oYZwuARRHvmTw== 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=j31BCaDIQXsXSkWq9Xib7jbddEm8iZVJcnUPR674CYM=; b=c3RVveqwRa8sFQllF3BJRWlJb+IrArRilocDRLfQGRq2QoPN45vGOseO9HTPLZEF8RJs7OHOiF/BsdFkDTp1VgR54wK5k3MMM0dtVS1A9j7cIE9dkOHF/UfIvzSqUR7bt9gSIoHDRaQMroLPx3RcHWv7IM1E8O3QkGc6Io5bqLxYK9G65QyJrliq92rkKiYjjbNa++mkFLdkM1J3sv+eQXU4n7xsabARMJ+8Fdrfr4+0phDRSUkEFekmFOvmWTZqJf7y0VzEUN9mTvP6HL3/PqaPuJZaVjZTieUdytHPm8O/N71W+Rl7ys1aqTugBqZev68tCzMYelX/bprPWsc7uw== 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=j31BCaDIQXsXSkWq9Xib7jbddEm8iZVJcnUPR674CYM=; b=sRSWh7ioNdghg7bVhoTrEmlY7OYuhWcAgWquXAsmVBKBr6rjpI3iWyAmD9jPR9vwkC+TwLsnS2eqhIs3pTUGv/tPCtjy/K/F4g4rXVo1wHDsVnhXyJvbWXOFYzaSmtCRKV2KvlkAQOLRWpNSrTTDGvdm4GZH60W0WY8Q7eOhUWP2C33rucrO9LPjbfupGyhA7JmpWDeU9DQgYm1PEd1AnEE9cDb+chixTpGZayuBQAXFx6xavttHJ1Gsy7tnFLV/fNq0+gLTfOJaZf/Q+QsSfj0obZaIYIyMReHTvuutQpj8OyvzlrSJkZtQDgmUyZFnnG8WE2SbjUnW7ngMIfXYqA== 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 SA3PR12MB7860.namprd12.prod.outlook.com (2603:10b6:806:307::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Fri, 20 Oct 2023 14:29:01 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::3f66:c2b6:59eb:78c2]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::3f66:c2b6:59eb:78c2%6]) with mapi id 15.20.6886.034; Fri, 20 Oct 2023 14:29:00 +0000 Date: Fri, 20 Oct 2023 11:28:58 -0300 From: Jason Gunthorpe To: Lorenzo Pieralisi Cc: Catalin Marinas , Will Deacon , ankita@nvidia.com, maz@kernel.org, oliver.upton@linux.dev, 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, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/2] KVM: arm64: allow the VM to select DEVICE_* and NORMAL_NC for IO memory Message-ID: <20231020142858.GH3952@nvidia.com> References: <20231012144807.GA12374@willie-the-truck> <20231013092934.GA13524@willie-the-truck> <20231013134541.GP3952@nvidia.com> <20231019115142.GQ3952@nvidia.com> <20231020114719.GE3952@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BN9PR03CA0788.namprd03.prod.outlook.com (2603:10b6:408:13f::13) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|SA3PR12MB7860:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e5dfbf9-3986-4971-8140-08dbd178e6e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tKrUjVOyyV6oCdYwGDezEjHSMjB7neTEqsCMMc+YNJcTHr/CtSS8fokpYfkfOAlTXFuJEuQR2/u5WMQsq/5qFioHwxJ36/mLI7pheTPOPuZEdzK0GnW47Gvy/NtgvNJ54dasEsg0s5S18YOgX9cunyVBh7RXFnAqB4xXvDjr3yq1CVN0tq6UEThLqh2fyrB7u+ME4BSPXJk/UO4rnQVq/1WXp9o0ECx7jO4LgkO/SkKtw5alxtugc/lT9eN7q/ilpGxahwjFw1fRRVwyTG3SsxE0Rztq6SpA3Kx7xVEelzAAWHgh/EMjpJgnUXnYsFLujLnncs3OEToBAFfS9zy01xOmFHfhW4VPC2rCa1tQpUnC7m0/EP5TrQlJPm1+Psi55KpkwMNAiB29PqwZqNM0RVqxmeKplCfflYvcm5A7XBE3y2H0S/XcCnpquHk3HmEHB0X6LcZTTIhoGPnIDhW54wZ6waKiGnAH3W/Kwu/t/3XWRq8NIiGkqnSe25U5d9ZQ/7eG1j0wQ3inhHigVGGf1rjfk/8HWjIA05CX1pCDN9waAk5OwmUE5wGus38031xe 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)(366004)(136003)(376002)(39860400002)(346002)(396003)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(26005)(66946007)(66556008)(6486002)(66476007)(478600001)(6916009)(54906003)(1076003)(86362001)(38100700002)(2616005)(83380400001)(5660300002)(33656002)(316002)(6506007)(36756003)(6512007)(2906002)(4326008)(41300700001)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?cGTHAByW6su7k3MekRbhWlttP8szHOVbtAt0wTIpCdhOVM9FhQ2hwD+M0yyb?= =?us-ascii?Q?f89KGHxdqD+l1LChI3Wzz0sNAxt1KhcmjngaVzSw1njjDOWGHS998b154XwU?= =?us-ascii?Q?l5ZnpyRt1lnZWRiO3Csx/c20gpU+dX7yvcDwuWcu7ath6MvW/rRPhoG0ymWQ?= =?us-ascii?Q?08NYFuUF+M23RkIkYLXaIQEauVzJ7jJcvvs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SR2PrkmYf2pp92RwiGwf5VWgL89iGL2fC7e2yRF/?= =?us-ascii?Q?MtDd4xuLu2A/vDHdfZKbmmwbDk3uNglZ06q3M/h1gshBFoaJBKMa4pYJyPGi?= =?us-ascii?Q?levDvWIc/jzu25KG06VTaZkMv1H6XcNWCEjlreBa9/x7uri+IkkW76E2M2MU?= =?us-ascii?Q?r8P7U06LlrVcBnWbTSsmp0H/XD+efBxdIRfLringJwxh4IOJHo6tXBMAhxo7?= =?us-ascii?Q?5txcJag+FJ2/zFMu7h9JgA08M/Ns3IiPdVm1vVQfT2+EbnKrmvJY2DQQjXK1?= =?us-ascii?Q?uGB57ozuHyTiIugpCkhSrmpUJoCBnEzVwapeZIjT9lRp9lH1sMP+u13BZxVz?= =?us-ascii?Q?72De8AG+DeMaQCOkOIEq7ssBrUGhD60q84WoG9JTIalPCNr3W50uFfc06XNu?= =?us-ascii?Q?nshLXKoAy9SJdUbINTrgAzeVLMoi+PWikKJvPcLkIJPHckRdxJS6Crh4Ov9X?= =?us-ascii?Q?ePTKgROF6/E+a/qHmUo4+NV9mEXBDQ+GuGCejitp?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e5dfbf9-3986-4971-8140-08dbd178e6e9 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2023 14:29:00.5505 (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: jCf3L0/lqfLAsMBojMyLdKRWktbNRmnCsCF/Z8QYfGDIUFsYREvGBZAPcPTgPD/F X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7860 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 20 Oct 2023 07:29:21 -0700 (PDT) On Fri, Oct 20, 2023 at 04:03:57PM +0200, Lorenzo Pieralisi wrote: > > My point is if this becomes a real world concern we have a solid > > answer on how to resolve it - fix the VFIO driver to have a stronger > > barrier before reset. > > Just to make sure I am parsing this correctly: this case above is > related to a non-PCI VFIO device passthrough where a guest would want to > map the device MMIO at stage-1 with normal-NC memory type (well, let's > say with a memory attribute != device-nGnRE - that combined with the new > stage-2 default might cause transactions ordering/grouping trouble with > eg device resets), correct ? This is what I have understood was Will's concern, yes. > IIRC, all requests related to honouring "write-combine" style > stage-1 mappings were for PCI(e) devices but that's as far as what > *I* was made aware of goes. Yes, this is what I am aware of as well. Though I do not object to the idea from the VFIO side that platform devices would also have to support NormalNC too. The theoretical missing peice is that someone would say they have a SOC issue XYZ and thus their VFIO platform devices must fully block NormalNC. I suggest if someone comes with this and really, really wants VFIO, then we could use a VMA flag to indicate that KVM must not upgrade it. Currently I have no knowledge of such a thing existing. With PCI we've made the argument that if NormalNC is broken unsafe for KVM in the SOC then probably so is Device-*. I think the same basic argument holds for platform devices too. Thus I'm skeptical that someone can come and say they have SOC issue XYZ and NormalNC is broken but Device-* is perfectly safe. > We will do that, I will start adding the recent discussions to the > new documentation file. Side note: for those who attend LPC it would be > useful to review the resulting documentation together there, it should > happen around v6.7-rc1. I will be there, let me know Thanks, Jason