From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4F8D3B0AC7 for ; Mon, 23 Mar 2026 13:59:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274350; cv=none; b=HZIhzQDwRlW8dsJ/+RJ920msdrrQO7SHEhvhKff0jvUfNKzMh8QQoUuecASD87jMZ9Vs9gwuThmkM45mL3Tu6m7Pm4RvFCV5z3eU1nLLazX2dUU/aCgccoO+lMTmkYekcB5Q0gCRBSw24jgCkABbpsSO92earpcAC4CF4sw4m1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274350; c=relaxed/simple; bh=FrJqgy6FrT/pl2LwdfE16n9Z4H8vmvSWs8GmjvMR+jc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ijh1k1ZcfL2u+2mnddMO8N+R8ErecLYYuKRT8TbR3z3dryCT9xBNmgMXXue1Jzj5y6ysWrJh0aA+cd2OQ6cZo1d44SCgnLziaOablwKlZinU7wuphXtaC8Xy7bKhLkDVkKjFxjktNzvcclsx6BDOSlzfyaV0iZY/6v1GOsbyG04= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OzcJ9XHe; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OzcJ9XHe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774274346; 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=bEtCE3UFyC9EUSjcg5HmiHx+sSKd6jmOnMFqB60P6ro=; b=OzcJ9XHeV0VkLipiMui9/kGUOEIfDVWiMga7dfdn08v9AV33vxyflHlHd9DQrU0rZicfOq gJgHVN6u5iwf36/Zo/PS89wlLeF3UNmsRCh+LygmejOva2QgcWpz9p8S4at/Oy7DqZCGSL qjbkWC3/BGZvDuf8RxCxpT4xCyW6vbY= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-184-aZLGv0CmPLaBSVN--sR69Q-1; Mon, 23 Mar 2026 09:59:05 -0400 X-MC-Unique: aZLGv0CmPLaBSVN--sR69Q-1 X-Mimecast-MFC-AGG-ID: aZLGv0CmPLaBSVN--sR69Q_1774274344 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-43b4dcdb372so2208139f8f.0 for ; Mon, 23 Mar 2026 06:59:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774274344; x=1774879144; 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-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bEtCE3UFyC9EUSjcg5HmiHx+sSKd6jmOnMFqB60P6ro=; b=Tq60GdknaEVc+aTb1FzygowvwzVZoALTu1Rcu8Iuv+kC27sgyfq1yiQ2TO5au+e1zT jNYsDltgvRg+d7VW8TwcyWEqCBFW0+c8K0uxU41QzhMgEdqg9BUQOutkCAA/UcVVlfpV qqiL/QL9LJ5K9qNuR3B95Q4ywz5Ly/hp80Z9zRJZblWxfcNxBz192seETlX4X/M6W11X +rSVYRY77kbXeMYRQ4T7aTUxU/X5neib7gxgKSSKiPWgKt5MEtB6w1CGTMk2M7fAmSD+ PWz7dVMgBrMhJFpUi/O6QX3DS80xKKSi1wSyIUk2Fb+flEBCTRWXcg6wBvOUo5sfpNAt 7xoA== X-Forwarded-Encrypted: i=1; AJvYcCXStHFaZpZUQwwATshEQqDwlnGeUQOHGBUGicqwALHRSYlQsrKr6vto80sniiDPXLJUBLrbmpvtwcw8WUI=@vger.kernel.org X-Gm-Message-State: AOJu0YwQtw4m30GOMYbqQEXdniHpcrI4qftC4NDjMOqu3H9aOzPakE4f AxYbEU/WjdvW3qyIROspzcgAN/rHTARUHWB+hS3Lwwt6JXcnmpkNFJpnVsx33t3WOspOJ/qBur6 CeaJ5WLKWz7pw/LJro0p5i14Yp64vMHZ2igulMBv0m9aI2an8W1syq1KDV9yax+6n47eHtvqOMw == X-Gm-Gg: ATEYQzwtnkTw1vgMP/mZn93tKf6/TnCpwsLmgZ/N8cPDgtHtOZVVxALL3WDH/5oEVnV cZA+E/qfnRhegL10+abzPYzvA03VOlFRvz7T8NVCGg2N0c1D8eNbZsiYxYWkhOtV8qDjdG18fxp heftsgp9I3Dulk7KYw39V5S4Zgv8yMW5whcC7GTpZuG6izFCvid5+vQB/XDlD54CcND6/6zTl9P SHGRsEgMdx2nmeQF9buzqmUtv2KDid+c9xMBTQPeEUDORMI7UMG3QuUfigechgxxlj3YjDP0o/Q 4hRasQQatB0rUTao8aovUKzRW+RrhRL6fnGCAXxdW9WEpIT6AtBznool+FcTJa9hcNBrEpPz4ni PgHtTVlvDxLD/EZlv2kdkjcvP9qT119Kq4G+FygNwZY4+5tf5VJNCT2m1mqoVFdoFWbT9ZQ== X-Received: by 2002:a05:600c:4fc8:b0:486:fbf6:abd4 with SMTP id 5b1f17b1804b1-486fedbf2d4mr182477875e9.9.1774274343810; Mon, 23 Mar 2026 06:59:03 -0700 (PDT) X-Received: by 2002:a05:600c:4fc8:b0:486:fbf6:abd4 with SMTP id 5b1f17b1804b1-486fedbf2d4mr182477085e9.9.1774274343151; Mon, 23 Mar 2026 06:59:03 -0700 (PDT) Received: from ?IPV6:2a01:e0a:f0e:9070:527b:9dff:feef:3874? ([2a01:e0a:f0e:9070:527b:9dff:feef:3874]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-486fe68ec05sm416952505e9.0.2026.03.23.06.59.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Mar 2026 06:59:02 -0700 (PDT) Message-ID: <772708e4-2878-41bc-b74e-8869bce7529c@redhat.com> Date: Mon, 23 Mar 2026 14:58:59 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: eric.auger@redhat.com Subject: Re: [PATCH 1/2] iommu/tegra241-cmdqv: Set supports_cmd op in tegra241_vcmdq_hw_init() Content-Language: en-US To: Nicolin Chen , will@kernel.org, robin.murphy@arm.com, jgg@nvidia.com, kevin.tian@intel.com Cc: joro@8bytes.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, skolothumtho@nvidia.com References: <7988aa837f02e44c0f436bb236cba0573bd8974f.1773361875.git.nicolinc@nvidia.com> From: Eric Auger In-Reply-To: <7988aa837f02e44c0f436bb236cba0573bd8974f.1773361875.git.nicolinc@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Nicolin, On 3/13/26 1:36 AM, Nicolin Chen wrote: > vintf->hyp_own is finalized in tegra241_vintf_hw_init(). On the other hand, > tegra241_vcmdq_alloc_smmu_cmdq() is called via an init_structures callback, > which is earlier than tegra241_vintf_hw_init(). > > This results in the supports_cmd op always being set to the guest function, > although this doesn't break any functionality nor have some noticeable perf > impact since non-invalidation commands are not issued in the perf sensitive > context. > > Fix this by moving supports_cmd to tegra241_vcmdq_hw_init(). > > After this change, > - For a guest kernel, this will be a status quo > - For a host kernel, non-invalidation commands will be issued to VCMDQ(s) > > Fixes: a9d40285bdef ("iommu/tegra241-cmdqv: Limit CMDs for VCMDQs of a guest owned VINTF") > Reported-by: Eric Auger > Reported-by: Shameer Kolothum > Closes: https://lore.kernel.org/qemu-devel/CH3PR12MB754836BEE54E39B30C7210C0AB44A@CH3PR12MB7548.namprd12.prod.outlook.com/ > Signed-off-by: Nicolin Chen Reviewed-by: Eric Auger Eric > --- > drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c > index 6fe5563eaf9eb..83f6e9f6c51d6 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c > +++ b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c > @@ -479,6 +479,10 @@ static int tegra241_vcmdq_hw_init(struct tegra241_vcmdq *vcmdq) > /* Reset VCMDQ */ > tegra241_vcmdq_hw_deinit(vcmdq); > > + /* vintf->hyp_own is a HW state finalized in tegra241_vintf_hw_init() */ > + if (!vcmdq->vintf->hyp_own) > + vcmdq->cmdq.supports_cmd = tegra241_guest_vcmdq_supports_cmd; > + > /* Configure and enable VCMDQ */ > writeq_relaxed(vcmdq->cmdq.q.q_base, REG_VCMDQ_PAGE1(vcmdq, BASE)); > > @@ -639,9 +643,6 @@ static int tegra241_vcmdq_alloc_smmu_cmdq(struct tegra241_vcmdq *vcmdq) > q->q_base = q->base_dma & VCMDQ_ADDR; > q->q_base |= FIELD_PREP(VCMDQ_LOG2SIZE, q->llq.max_n_shift); > > - if (!vcmdq->vintf->hyp_own) > - cmdq->supports_cmd = tegra241_guest_vcmdq_supports_cmd; > - > return arm_smmu_cmdq_init(smmu, cmdq); > } >