Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1048554rdh; Mon, 25 Sep 2023 01:18:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYRNQimBfAVoUj6pYkJVhCkW2+d/ZrjAxv/okbgkjykwHALpV3xUNw0EhCKwrrQVZEfcUt X-Received: by 2002:a0d:ca89:0:b0:59b:e666:1fb4 with SMTP id m131-20020a0dca89000000b0059be6661fb4mr6108400ywd.9.1695629916896; Mon, 25 Sep 2023 01:18:36 -0700 (PDT) Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i125-20020a639d83000000b00582f1f73c80si1976394pgd.466.2023.09.25.01.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:18:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C0rI1InH; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 910E980743E8; Sun, 24 Sep 2023 23:37:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232048AbjIYGhq (ORCPT + 99 others); Mon, 25 Sep 2023 02:37:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232083AbjIYGho (ORCPT ); Mon, 25 Sep 2023 02:37:44 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D8C1180; Sun, 24 Sep 2023 23:37:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695623855; x=1727159855; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=jKJ8V362BQdHWqFbTznKMcA1eRLGZdTPHqIMHIbNdt4=; b=C0rI1InHdab7PrsMV/dodtGK+OsqPvA0e64O91l3qtbz5241E94p4r4P +E0obHys9LtJA8mII/I+ClHWNaaA4D7O9IiQWEkiZmp2RGMYEh0C8ZB7A rBWRMZUfbOfFt4+pbHtNF/i88zFFsRYnmizdMhRsMApP44mP98pOq/PJa ilruUB5VGlBv0AKR3+mfIcxFYDPZogoi16srSW7oTnGit5x9AwvxPzA0Y rH1ciTyi5GGDK9TshNVZdfNuo9S1YuqFuJ03FkelVZ1EouMiXXpREhT+0 aImXntO2bW0ENmIIfNcY6rFblyYZeRqlyk/Y2qMrK6MXN/8tqBjUE/sdK A==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="447664731" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="447664731" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2023 23:37:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="748246909" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="748246909" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 24 Sep 2023 23:37:33 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Sun, 24 Sep 2023 23:37:33 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Sun, 24 Sep 2023 23:37:33 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Sun, 24 Sep 2023 23:37:33 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.176) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Sun, 24 Sep 2023 23:37:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Swd2q0+QVExZUHmiUIz784mTT9N7a1YBOFvHGtdKZ42yazJSf0Q0A/2na7YZFpFmlJb4j1AFJxuZywRJBdmKZz6gioZbZuZ6CZHAIb0/94xSOK7lW2HGbvD1ihYITjgGWIe5AbHnXVxhrk/xL2psEMRamP5qM8HzyrM1dbML4Lyi6s27RA4U+7HDi+21cPlHp02jsWxNvhv/QFzzSeOYDA9QplwgOGTsNAbKSXUdqUEGyDchVb1UBlYT5Yz7Lu+x6YTc/Z05/YFfJL6zFgQui7tTMFK10Y3XfIcJsfkzc1911cqAKfu23CohjIgmjS63ZZdnmbKA6N3qJtXdD/Zo1g== 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=0mZTRiTgrzdELmEk+ek/5ictgxweyoh7+BEkMNx/iuQ=; b=cJEZczaUmltm2vXLUwGqvg41unq67wJmLml3QlqlNl/9kv1MyZ7Dae1S7f86wK7284GpKr4t73yRNxQvP62T7Jcr/kqcD0Adz+VQXzIzdz+u29Nkn7yGy/KHh6baHgLYGmFkBYJNZVbLAShgTI/ygEsc38PGoFqfY0DFLDLZwhKodoK+L1+yinvyWu+1ZvYCYef8DTSf+zBn+WKt8w726FvEqAcU+7LLE3H7nP9OAgIv9+6mjRmp8Mm6rocfylgmQM77xQJBSR75asr2GESzVjppzOri/0NSZOV3KNFV8i5BEMfCX35yi1sk5XPozlBnW7eq2mYf201ieGjaQ9OWHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7529.namprd11.prod.outlook.com (2603:10b6:8:141::20) by CY5PR11MB6090.namprd11.prod.outlook.com (2603:10b6:930:2e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.30; Mon, 25 Sep 2023 06:37:30 +0000 Received: from DS0PR11MB7529.namprd11.prod.outlook.com ([fe80::f8f4:bed2:b2f8:cb6b]) by DS0PR11MB7529.namprd11.prod.outlook.com ([fe80::f8f4:bed2:b2f8:cb6b%3]) with mapi id 15.20.6813.027; Mon, 25 Sep 2023 06:37:30 +0000 Message-ID: <740a4ede-4eaa-2775-ac31-3fa7c905e201@intel.com> Date: Mon, 25 Sep 2023 14:39:47 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.13.0 Subject: Re: [PATCH 4/6] iommufd/hw_pagetable: Support allocating nested parent domain Content-Language: en-US To: Baolu Lu , , , , , CC: , , , , , , , , , , , , , , , , References: <20230919092523.39286-1-yi.l.liu@intel.com> <20230919092523.39286-5-yi.l.liu@intel.com> <7d07bea9-02a5-7113-8cc1-f7aed073cf96@linux.intel.com> From: Yi Liu In-Reply-To: <7d07bea9-02a5-7113-8cc1-f7aed073cf96@linux.intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2P153CA0012.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::15) To DS0PR11MB7529.namprd11.prod.outlook.com (2603:10b6:8:141::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7529:EE_|CY5PR11MB6090:EE_ X-MS-Office365-Filtering-Correlation-Id: 63ffbd7a-8d60-445f-c766-08dbbd91e43a X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l6eIaf/Fp+fh85K5cId8knpsFttCKn5RV7qTPbYqE573cxNYfPplfyRxzkzq+sKPTd3fSnZV3qK2q+Zod1lpkyu166G570PP06NLwwJjP82QTUXJNxL2eBMsz/2Hv7hp8dPrXJpqpiw08zZB2lMepPyjv6p1dH/F+BqUD7r5cnvd5kSRdiSVUXXls+hC+JQPIGx3OmR1YglZIfp+1VavFIs7Eus6RI6Ca9d8sxtEKlXqJa5pRStita5a3fYDJy6F2KZBtTGbZvM1t3E3Gyfg+YmKoPyhrmRPKT0YkNByXsgSZm35GRUhoEhSdCbdmaBmePOBslXGH5ANssP7y/wpTPZHXONMZAVUx22lpnXBpPqCdyOz8/1gnVuHccxAQ26DfrPma9S5lrMeV/7I7dnkeToK/YWF3OWx8YRd8N6V4D4OHg8oT7MLKweCpkRJbTX0g2YondfbHIcaWrSNrLEyk/o4Rm/JcyhdQ6PFQwFnbhoBOZihz1jMhLO9Es+r65BT+nDcS4wqe8ZW7jYgjkGkSmv8ZPVDav649/l+41GLjhrakbaTGylX3pM32cmrOPVQbx3yiE2xpa14OrbWry02eUEPng7EAhNpNKNepEzrOtKngtIu/FKWFayT4P94qS5Eg7+mBEl2vaolGyy4wMvmyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB7529.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(136003)(366004)(376002)(346002)(230922051799003)(1800799009)(451199024)(186009)(6506007)(6666004)(6512007)(53546011)(6486002)(36756003)(478600001)(5660300002)(8936002)(2616005)(66556008)(66946007)(316002)(7416002)(2906002)(26005)(8676002)(4326008)(66476007)(31696002)(41300700001)(38100700002)(82960400001)(86362001)(83380400001)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dkpMNm5rOEZ3UEVkNmNoeUxLZVFOUnB2a3pZa2Y0WTFvZ3kzU1FCcHZlZ3Zt?= =?utf-8?B?ZHQwdTZsN01LYjg1K3V6NkUycjd5WmFYaWw1RGdqa29Hc3dkUjczeWJCRnY1?= =?utf-8?B?R2dJRk50SVB4YUR0UCtaMmFYUnJXYnJjSUZDYWhpSEIxd3lYYXlYRG0vUHlW?= =?utf-8?B?YmhuMDhQODlnY3J1QStBNCtZcHplb1pKU2NYSzZrWDlwMDkza3hkSFR5UW9j?= =?utf-8?B?TDM0ZDUyNHFCOWVteWdZOWQvcDZabkNCMFg5RlF4enRpKzdydHhoa2tWUzRv?= =?utf-8?B?WVR5Ni90STcrSWpYTFVYVzAzRVlvbjI1YVZtQldUYnZ5SWtla25YalF5Uy9I?= =?utf-8?B?aC9ERHpOR1hYRHN6dmR1bjFm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-Id: 63ffbd7a-8d60-445f-c766-08dbbd91e43a X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7529.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2023 06:37:30.3087 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uZetsmvOt1frGe+8vW+L5LoUswYpQ2Vxq2/qYjleYNhN1vXq9fsvxEiI9BSbWz0EFfeZb/CNWB0aSlX5G7Ov6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6090 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 (howler.vger.email [0.0.0.0]); Sun, 24 Sep 2023 23:37:44 -0700 (PDT) On 2023/9/20 13:05, Baolu Lu wrote: > On 9/19/23 5:25 PM, Yi Liu wrote: >> This extends IOMMU_HWPT_ALLOC to allocate domains used as parent (stage-2) >> in nested translation. >> >> Signed-off-by: Yi Liu >> --- >>   drivers/iommu/iommufd/hw_pagetable.c | 5 ++++- >>   1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/iommu/iommufd/hw_pagetable.c >> b/drivers/iommu/iommufd/hw_pagetable.c >> index 5be7a31cbd9c..26a8a818ffa3 100644 >> --- a/drivers/iommu/iommufd/hw_pagetable.c >> +++ b/drivers/iommu/iommufd/hw_pagetable.c >> @@ -83,6 +83,9 @@ iommufd_hw_pagetable_alloc(struct iommufd_ctx *ictx, >> struct iommufd_ioas *ioas, >>       lockdep_assert_held(&ioas->mutex); >> +    if ((flags & IOMMU_HWPT_ALLOC_NEST_PARENT) && !ops->domain_alloc_user) >> +        return ERR_PTR(-EOPNOTSUPP); >> + >>       hwpt = iommufd_object_alloc(ictx, hwpt, IOMMUFD_OBJ_HW_PAGETABLE); >>       if (IS_ERR(hwpt)) >>           return hwpt; >> @@ -154,7 +157,7 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd) >>       struct iommufd_ioas *ioas; >>       int rc; >> -    if (cmd->flags || cmd->__reserved) >> +    if (cmd->flags & ~IOMMU_HWPT_ALLOC_NEST_PARENT || cmd->__reserved) >>           return -EOPNOTSUPP; > > Need a parenthesis here, otherwise the compiler will interpret it as a > different condition. > >     if ((cmd->flags & ~IOMMU_HWPT_ALLOC_NEST_PARENT) || cmd->__reserved) >         return -EOPNOTSUPP; ok. -- Regards, Yi Liu