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 F2714C433EF for ; Fri, 1 Jul 2022 06:54:48 +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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject:MIME-Version: Date:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fjVZ/UBGad7TDYPwfrOBFjx9fvaPZHILWbGtu6Ie4Z8=; b=xqdNxrtTow0GfCcWwsqaDcnHfC m9EAhzIrBvhDDUvqOd1Ikxz7QpvT2CzXuEKWNQeKN78SCkflu5dQqzt7Pj53LR1+tZjO/prrFKcYy qxAAeaK/Z07ksYmPr9GoCewwMCJrJLwErNYsMaDcZaoYIsoAqUmT/mYg3vWRmk/U9bqfTPet2Bl9z zG1vHX7WThG7fQgGyPZmVudvit3bTui6PlSWnUDEshJSFJavIHYmXNrwJBuhzSyWTO28SUoahy55l y0yh6TetLsuIPGEJGsUK71mqFh/2CgVHlKU5qMW26kUGj/b4yhd4vHyzYnQZlwcB/0a6ExsyPh5DF 9qQ4xpWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7AX8-003H9Q-9B; Fri, 01 Jul 2022 06:53:42 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7AX5-003H7m-7O for linux-arm-kernel@lists.infradead.org; Fri, 01 Jul 2022 06:53:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656658419; x=1688194419; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=lT6Q657TSg/9MG9w0C8hYZ86wxuoFIRctv6pNkUIO7Y=; b=BwSTtO96jwqzTC2Uzz5D8A9JCyMIQxXOtxRylqkYa0Bpxqb3WPbVVajA Jbb67KukFuTUCtZyaogGDiR+rQUJotNgdAYwHUaZbTjLuTgqUHXHMu9CS 0e2iEcErtVaE6NDo6mfe6iPdKHR2FAfwXxD5UoLNZgcmWksRyHVY1/4Nn Mhh/uY9ea2rHAh5L0kIVDM76B7quVw3idDFb2GAZ18jzZsYsMhZCkYpil YwuLbjKdhVss19Gbl1XQW9Bjg34xBFuhKhEw7+J2oGCY0DVkPzczk3a15 ymy8BMsWfiWyuga7kexmuf0Fsn7z1/H2CCNZGXh2/nQXHQxti37n5dpnc Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10394"; a="262369544" X-IronPort-AV: E=Sophos;i="5.92,236,1650956400"; d="scan'208";a="262369544" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2022 23:53:27 -0700 X-IronPort-AV: E=Sophos;i="5.92,236,1650956400"; d="scan'208";a="596134247" Received: from pchai-mobl.ccr.corp.intel.com (HELO [10.249.171.241]) ([10.249.171.241]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2022 23:53:15 -0700 Message-ID: <0db46319-30c9-5d78-4467-79246ac454e4@linux.intel.com> Date: Fri, 1 Jul 2022 14:53:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v4 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group Content-Language: en-US To: Nicolin Chen , joro@8bytes.org, will@kernel.org, marcan@marcan.st, sven@svenpeter.dev, robin.murphy@arm.com, robdclark@gmail.com, orsonzhai@gmail.com, baolin.wang7@gmail.com, zhang.lyra@gmail.com, jean-philippe@linaro.org, alex.williamson@redhat.com, jgg@nvidia.com, kevin.tian@intel.com References: <20220630203635.33200-1-nicolinc@nvidia.com> <20220630203635.33200-2-nicolinc@nvidia.com> From: Baolu Lu In-Reply-To: <20220630203635.33200-2-nicolinc@nvidia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220630_235339_306209_FB22E62B X-CRM114-Status: GOOD ( 16.78 ) 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: , Cc: mjrosato@linux.ibm.com, virtualization@lists.linux-foundation.org, thierry.reding@gmail.com, alyssa@rosenzweig.io, linux-s390@vger.kernel.org, kvm@vger.kernel.org, jonathanh@nvidia.com, iommu@lists.linux.dev, yangyingliang@huawei.com, gerald.schaefer@linux.ibm.com, linux-arm-msm@vger.kernel.org, john.garry@huawei.com, christophe.jaillet@wanadoo.fr, thunder.leizhen@huawei.com, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chenxiang66@hisilicon.com, cohuck@redhat.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, suravee.suthikulpanit@amd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022/7/1 04:36, Nicolin Chen wrote: > Cases like VFIO wish to attach a device to an existing domain that was > not allocated specifically from the device. This raises a condition > where the IOMMU driver can fail the domain attach because the domain and > device are incompatible with each other. > > This is a soft failure that can be resolved by using a different domain. > > Provide a dedicated errno from the IOMMU driver during attach that the > reason attached failed is because of domain incompatability. EMEDIUMTYPE > is chosen because it is never used within the iommu subsystem today and > evokes a sense that the 'medium' aka the domain is incompatible. > > VFIO can use this to know attach is a soft failure and it should continue > searching. Otherwise the attach will be a hard failure and VFIO will > return the code to userspace. > > Update all drivers to return EMEDIUMTYPE in their failure paths that are > related to domain incompatability. Also remove adjacent error prints for > these soft failures, to prevent a kernel log spam, since -EMEDIUMTYPE is > clear enough to indicate an incompatability error. > > Add kdocs describing this behavior. > > Suggested-by: Jason Gunthorpe > Reviewed-by: Kevin Tian > Signed-off-by: Nicolin Chen Reviewed-by: Lu Baolu Best regards, baolu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel