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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 8E599C64EC4 for ; Fri, 10 Mar 2023 16:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References: Cc:To:Subject:MIME-Version:Date:Message-ID:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NSpibPTl1078d/B6E53L8RPL9HBLrMAmUQjUpBHTlac=; b=XNVdBbqBgk6Y3W z1556fC6KigY9+KHYaAXgy55bzyVxseuffiSHa81/YndpblzjK/acfN7XAePYK4G4/CIqxRHYx3y6 Nm3uBxMyUuh1jrdncrWMKqzFbHvMrgNX/1gPMXFP3uKc0Q905Z2/s7TWtgcZ1VskF+yc3YhFFAWuM GJOli4+CLclqUUH3OyyzqIo8ueOn+HADLsTXAFxIAliS4ZKcr/RjxOgZpmPMBARO9WnyzyRC1w2Lm +Oh1ZqMs4utzKcryqvERN9H8KkIOxplJsJMgiSYTgb1ASXbIc9jvSnj/mxRasTBhi142cULT5a/LJ nElfMl87wBcWCVuSmzIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pafmJ-00FKc2-6y; Fri, 10 Mar 2023 16:39:35 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pafmG-00FKao-Je for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2023 16:39:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678466367; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x2rMsg6t2gpViRN6bqN88ZiiAOU5boBM+zQvjcM7TMo=; b=Bz+rXBjPhg+S3sugJcJWVIsad5znj4PrQfUTFF6ly6I1k762IhIvYIEhwmZKdQ24bfvNCQ K/nanyVNuACBqtvjS7EwSTUARgNEHQ1FIGowNc3562+MndaOVh9X2yv2LD9bBmG1eYsPS7 0rlJjKb11vFcV5OOMXQUzq1BtJC1aZM= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-526-D7rjDp89Mvu8u-76n1_SXQ-1; Fri, 10 Mar 2023 11:39:26 -0500 X-MC-Unique: D7rjDp89Mvu8u-76n1_SXQ-1 Received: by mail-wm1-f72.google.com with SMTP id c7-20020a7bc847000000b003e00be23a70so4101905wml.2 for ; Fri, 10 Mar 2023 08:39:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678466364; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=x2rMsg6t2gpViRN6bqN88ZiiAOU5boBM+zQvjcM7TMo=; b=79JCbnjkAsm5u+pg9WlnzR0/Ry7GLszoK21DQjguH/n8nhh0qYpgeQ/GGFjbupzgYo 6Cb2CiyovGoij6iY1mgRT17WPtqiE5KEwR3bp1ogp7cloeXRugSR0EHmo2duQ6lbBfb5 B4yUeVi9TNQW09CyFY+IbH2gQ6VCynrKUlhLJ0x+L8OJTE15NDSDVVRKeLkfNM/1cVJu 5J/o9dRr26YDmMZYcL/1tMALImCslxn9dg9MApuWkzw3L/xqg1qx2vX3Jdq50PDvNWoo FFUnfnOXc88BqpPLUZwYDedM8VqSn7qPFvykF2rwI3vc/+RNChfLLRRokPv7TSKYQNRT QwzA== X-Gm-Message-State: AO0yUKUNUV2LsOc/q6eOeE3powMJf5wtR241KcK6BJDg5nnDqJJHz+l3 Q3huaGwM0RANb2iPhBSFP7UQv2d0vcXcvqODgjpLINJ8bXdDWuhqrNS0ME/WAWWnGDAu/ckc5rU 541KESxrQOfYcsRkvvzBYtZmYCJXJ1tRoFnI= X-Received: by 2002:a05:600c:ccf:b0:3eb:36fa:b78d with SMTP id fk15-20020a05600c0ccf00b003eb36fab78dmr3280361wmb.23.1678466364783; Fri, 10 Mar 2023 08:39:24 -0800 (PST) X-Google-Smtp-Source: AK7set83LJfy7UcSeciFVaK0LlOXd8mOfJpZCllpxwIk2za7QGb9MdB56MsPoQHTRXi3GIMHfwS0rA== X-Received: by 2002:a05:600c:ccf:b0:3eb:36fa:b78d with SMTP id fk15-20020a05600c0ccf00b003eb36fab78dmr3280348wmb.23.1678466364527; Fri, 10 Mar 2023 08:39:24 -0800 (PST) Received: from ?IPV6:2a01:e0a:59e:9d80:527b:9dff:feef:3874? ([2a01:e0a:59e:9d80:527b:9dff:feef:3874]) by smtp.gmail.com with ESMTPSA id u10-20020a7bcb0a000000b003e11ad0750csm305406wmj.47.2023.03.10.08.39.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Mar 2023 08:39:24 -0800 (PST) Message-ID: <1c18d68c-a20d-0f6d-4bf7-56f40557d151@redhat.com> Date: Fri, 10 Mar 2023 17:39:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v1 05/14] iommu/arm-smmu-v3: Remove ARM_SMMU_DOMAIN_NESTED To: Nicolin Chen , jgg@nvidia.com, robin.murphy@arm.com, will@kernel.org Cc: kevin.tian@intel.com, baolu.lu@linux.intel.com, joro@8bytes.org, shameerali.kolothum.thodi@huawei.com, jean-philippe@linaro.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org References: From: Eric Auger In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230310_083932_726991_699BE1AF X-CRM114-Status: GOOD ( 21.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: eric.auger@redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Nicolin, On 3/9/23 11:53, Nicolin Chen wrote: > IOMMUFD designs two iommu_domain pointers to represent two stages. The S1 s/designs/uses? > iommu_domain (IOMMU_DOMAIN_NESTED type) represents the Context Descriptor > table in the user space. The S2 iommu_domain (IOMMU_DOMAIN_UNMANAGED type) > represents the translation table in the kernel, owned by a hypervisor. > > So there comes to no use case of the ARM_SMMU_DOMAIN_NESTED. Drop it, and > use the type IOMMU_DOMAIN_NESTED instead. last sentence may be rephrased as this patch does not use IOMMU_DOMAIN_NESTED anywhere: Generic IOMMU_DOMAIN_NESTED type will be used in nested SMMU implementation instead. > > Also drop the unused arm_smmu_enable_nesting(). One following patche will > configure the correct smmu_domain->stage. > > Signed-off-by: Nicolin Chen > --- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 18 ------------------ > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 - If you go this way you may also remove it from arm/arm-smmu/arm-smmu.c. Then if I am not wrong no other driver does implement enable_nesting cb. Shouldn't we also remove it and fellow iommu_enable_nesting()? Thanks Eric > 2 files changed, 19 deletions(-) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > index c1aac695ae0d..c5616145e2a3 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -1279,7 +1279,6 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, > s1_cfg = &smmu_domain->s1_cfg; > break; > case ARM_SMMU_DOMAIN_S2: > - case ARM_SMMU_DOMAIN_NESTED: > s2_cfg = &smmu_domain->s2_cfg; > break; > default: > @@ -2220,7 +2219,6 @@ static int arm_smmu_domain_finalise(struct iommu_domain *domain, > fmt = ARM_64_LPAE_S1; > finalise_stage_fn = arm_smmu_domain_finalise_s1; > break; > - case ARM_SMMU_DOMAIN_NESTED: > case ARM_SMMU_DOMAIN_S2: > ias = smmu->ias; > oas = smmu->oas; > @@ -2747,21 +2745,6 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev) > return group; > } > > -static int arm_smmu_enable_nesting(struct iommu_domain *domain) > -{ > - struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); > - int ret = 0; > - > - mutex_lock(&smmu_domain->init_mutex); > - if (smmu_domain->smmu) > - ret = -EPERM; > - else > - smmu_domain->stage = ARM_SMMU_DOMAIN_NESTED; > - mutex_unlock(&smmu_domain->init_mutex); > - > - return ret; > -} > - > static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) > { > return iommu_fwspec_add_ids(dev, args->args, 1); > @@ -2890,7 +2873,6 @@ static struct iommu_ops arm_smmu_ops = { > .flush_iotlb_all = arm_smmu_flush_iotlb_all, > .iotlb_sync = arm_smmu_iotlb_sync, > .iova_to_phys = arm_smmu_iova_to_phys, > - .enable_nesting = arm_smmu_enable_nesting, > .free = arm_smmu_domain_free, > } > }; > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h > index ba2b4562f4b2..233bfc377267 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h > @@ -704,7 +704,6 @@ struct arm_smmu_master { > enum arm_smmu_domain_stage { > ARM_SMMU_DOMAIN_S1 = 0, > ARM_SMMU_DOMAIN_S2, > - ARM_SMMU_DOMAIN_NESTED, > ARM_SMMU_DOMAIN_BYPASS, > }; > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel