Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp359805lqm; Wed, 1 May 2024 02:54:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX12r81nIbZ6mTOtOVYV181uFX1yQfc1VO19Oqz4ASHUUqh7Cgls7Ave5sqKuXadMw5CTR4yKBuXnou8dpA5PIfC/di0Zc3cgoDKooNNQ== X-Google-Smtp-Source: AGHT+IE8XgxSGaZTnHVL4VimdTt/37+8nY4NeajmNqCs9T4tN04/B5XjBTwe9ntaqPWbFzidO3zH X-Received: by 2002:a17:902:ea11:b0:1e8:37ea:d10 with SMTP id s17-20020a170902ea1100b001e837ea0d10mr2670355plg.56.1714557244292; Wed, 01 May 2024 02:54:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714557244; cv=pass; d=google.com; s=arc-20160816; b=ZOXJcCcphrKrXmezjGkxHfhq3LDV1q4gdYQSccsAg33aYHsH7C+YnimiHbbNtdlUhi cygqbWU+QyjsqtlITlD+TVTl05w19fgbifnr9S8W2RiIQRrvSSJ3Bklswxjqrg0ypy0w eFZQVJVSFaXSKtj8uFiKm9q3s7TkyeorrIweMaBsNplf/lkjO5cbtlTIaXeTtblXi1tx VB8PpM4Cv6RXFLLSKiieNHVEwzNMGW5m1/CWoCmxN64XquQYHfNYYHpo/ZUVlsWZSG9W fEjN3nzjg9FR/qdDqc9mdTWeDTbO1MmgcjVS1FQawgJ7/SK4zYomjcGn8bz3+Nxh88vv f5jA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=hEHkRXyutKIdDtbFkoGqCEEr7CXfrk5X5oQXQmKESes=; fh=GZpB+23hS60jmu+hKJaXmUS0z/LJyB8ihlMvW8pUUB4=; b=yBXfG7j5UGjdqUX8BacxZTXAASOEXTYlBUdHO2vhEzG7016bkW59dOJoyRGZVQ2R8R cchkzy+3ry6rKcWdgt2CTLppr+UW+k9YMd79I2YlZd5gzA0+wRd6lnsXUf1CzZkkCjjH 8WvI0ahWIPXdW2K+yy587qTuHVLmxTlg5/1qxpZpKwI5+A9dIC8UxofiAvaW81tA+IY1 ewX19LHpY4S8h0dL4VvpxCyhm1ozzlCglLxa8kuHdQiyrYfdTETz5JDxKdu/MBfyF9yV rxZaxZo3/2RhfvSERGtCln3SzOySUWBp9CRNXCGM4xiDPO2xF/Ej0dw5pQU36K2RL6tu eSCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZPeKcYz8; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-165115-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165115-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q6-20020a170902a3c600b001ec5ac16345si2427280plb.368.2024.05.01.02.54.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 02:54:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165115-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZPeKcYz8; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-165115-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165115-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 81CDC283508 for ; Wed, 1 May 2024 09:54:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 408D551C4C; Wed, 1 May 2024 09:53:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZPeKcYz8" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 E74954204E; Wed, 1 May 2024 09:53:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714557237; cv=none; b=ZeIevWZXXWOhXnVfx1wieCPRmmdV62pwCC3rU6PFbslxi//vmg5soZWpSWDEjLjf/H+ATGZrFZYcI6HqMlNFbkYDjFERDr9TCBicQjOPHf9aQa0CuWExhOBTo+t6lpiNhtpHc6AN8P7tz978ae5kOumkE17SWKMyOV9fK3j4bMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714557237; c=relaxed/simple; bh=Hb846Cf7SRZX9pIUAJ1q07Z7Vsj0+r1xmkNfW29a3ZQ=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=CLPyiBkclPq4zhTR3j+L/Q8RR71SPs978vexnNu3GJwzMevVsYmbbsuErivnZBsT6/zT6Twgqofb0qKi1fnjhjsSd5tyjaGic5ErNs5zUi5OTJItiBAHi1ZHamIkPzQ22dhz4lxaUudlai0cx1ZOS8ldMFJ2iFfXrxj6jPpnl5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZPeKcYz8; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714557236; x=1746093236; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=Hb846Cf7SRZX9pIUAJ1q07Z7Vsj0+r1xmkNfW29a3ZQ=; b=ZPeKcYz8FHnp3NVE8oSBwdDJD/oiqJw5SRSLpq2kcrSQbDW8AXdV4/Hg zoQOjFWx+OsZOI8Xw5sE37cZ424HHv4DhOm/mZ6lv73AKdJk95rrMV5Hi M+EPReGSBSVVOL+Ya9DWIMKgZDt6C00KTMBEmjhgZ6+PfnsL62ncj1rsK vST7VK4WYfcJq/8jRwnYIhafuyi8ZLZWy10qqVAAtGHFmpCr5z039uykN KVpjMzoHnLxYvk+6rk3VxR9QrfZqEOwtM69C51vsziMlGL9mEaCVy9hvv MobbEvxitCYbUDd1mW9VrsJWj2nvUwDZk3kjWItHToV3DF9mDLxh+9zFG A==; X-CSE-ConnectionGUID: B1fAsC9CSHy8OzOLeKwctw== X-CSE-MsgGUID: /XGlda/vTYahtY4WHmkQrA== X-IronPort-AV: E=McAfee;i="6600,9927,11060"; a="27730361" X-IronPort-AV: E=Sophos;i="6.07,244,1708416000"; d="scan'208";a="27730361" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2024 02:53:55 -0700 X-CSE-ConnectionGUID: aAIcMIixT9Wtz8LRNgu3+Q== X-CSE-MsgGUID: rSDqELpPRceJmOjVWPQj2Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,244,1708416000"; d="scan'208";a="31455876" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.124.225.176]) ([10.124.225.176]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 May 2024 02:53:50 -0700 Message-ID: <89cbae17-58dd-4c06-9f24-0c651209f037@linux.intel.com> Date: Wed, 1 May 2024 17:53:48 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, Palmer Dabbelt , Albert Ou , Anup Patel , Sunil V L , Nick Kossifidis , Sebastien Boeuf , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, iommu@lists.linux.dev, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux@rivosinc.com Subject: Re: [PATCH v3 4/7] iommu/riscv: Enable IOMMU registration and device probe. To: Tomasz Jeznach , Joerg Roedel , Will Deacon , Robin Murphy , Paul Walmsley References: Content-Language: en-US From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/5/1 4:01, Tomasz Jeznach wrote: > Advertise IOMMU device and its core API. > Only minimal implementation for single identity domain type, without > per-group domain protection. > > Signed-off-by: Tomasz Jeznach Reviewed-by: Lu Baolu with some nits below. > --- > drivers/iommu/riscv/iommu.c | 64 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 64 insertions(+) [..] > static int riscv_iommu_init_check(struct riscv_iommu_device *iommu) > { > u64 ddtp; > @@ -71,6 +126,7 @@ static int riscv_iommu_init_check(struct riscv_iommu_device *iommu) > > void riscv_iommu_remove(struct riscv_iommu_device *iommu) > { > + iommu_device_unregister(&iommu->iommu); > iommu_device_sysfs_remove(&iommu->iommu); > } > > @@ -96,8 +152,16 @@ int riscv_iommu_init(struct riscv_iommu_device *iommu) > goto err_sysfs; > } > > + rc = iommu_device_register(&iommu->iommu, &riscv_iommu_ops, iommu->dev); > + if (rc) { > + dev_err_probe(iommu->dev, rc, "cannot register iommu interface\n"); > + goto err_iommu; > + } > + > return 0; > > +err_iommu: > + iommu_device_sysfs_remove(&iommu->iommu); > err_sysfs: > return rc; > } It's better to make the goto label indicate what is going to be handled. So it's more readable to make it like this: err_remove_sysfs: iommu_device_sysfs_remove(&iommu->iommu); Best regards, baolu