[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN][PATCH v10 12/20] xen/smmu: Add remove_device callback for smmu_iommu ops


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 30 Aug 2023 11:17:30 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • 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=vPWfjUTCVBW710LysYyH8ZsWqYJ2yZfZW8lzgdHph2A=; b=LRFrPb2vAtE1lYXwiWR4LYhPAfJ/4lON6FB3oFmRQmHITxuAdrArq3DEHezIiHnJx1UJcwcMWr5TjQFryao/lbeTLPAX0ECJ5PmBu0a9WqmB3xRCGUkB3E70iatGkvd+aBjT++BZmy7ypW+nwueKb3fBphjb7cRlLmg07gXrQrAiiPpmUTTmoZhR8KwtMT7O8AWNWIGvhT+EePgz3VnlmP/JuCpOwg5EgyjJCmqDVe00qED8TXxrMAFR9hbv/qzjyg6CeQuzHYgdDKZtgcxTRVJXX8eeuQ5Ge/7lT0NF3A27UsETedXce9S1ezkzdglTBHf9HFW4HuegdY1LtJ3crQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=igKX57G4txnMs+fj2fY3qzrsJkecmFtU0N9BCvNr5401yRHmYks0ccWevduhGLqAl5cKNhpRsmQOrIzPc1xWDSg1Ijz4QnbYJ/1iInC0Vro2B8QTg4uELH90aikH3bb6MJ6HmXZ2lcYB5CJ7NhB+8YPQHmJ5Nx13xMGTDrY+IplTUyZO1uBxre0P5BPE0M1S0/msGhx16VWTqb4HO2VAx54cHKZDJwTrpJy6t0BeGeXF+GlmnPdtdj8o3Yg76RmduObqwuUQqOgw5PiKx39mr2u2qt+mj3Rx9R+C7xQF4Wjkl8YUj9kPKOjjEPQRxHSBLi0Lr7/JFtpJF/oy3Dwh6g==
  • Cc: Vikram Garhwal <vikram.garhwal@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <julien@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 30 Aug 2023 09:17:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 30/08/2023 00:45, Stefano Stabellini wrote:
> 
> 
> On Tue, 29 Aug 2023, Michal Orzel wrote:
>> On 25/08/2023 10:02, Vikram Garhwal wrote:
>>> Add remove_device callback for removing the device entry from smmu-master 
>>> using
>>> following steps:
>>> 1. Find if SMMU master exists for the device node.
>>> 2. Check if device is currently in use.
>> Since you removed a call to iommu_dt_device_is_assigned_locked(), you do not 
>> check it from SMMU, right?
>> You are relying on a check done in iommu_remove_dt_device().
>> This wants to be mentioned. However, Julien suggested to do the check for 
>> internal SMMU state.
>> Looking at the code, when the device is assigned, we do:
>> dev_iommu_domain(dev) = domain;
>> and when de-assigned:
>> dev_iommu_domain(dev) = NULL;
>>
>> This means that before calling remove_smmu_master() you could do:
>>
>> /* Make sure device is not assigned */
>> if (dev_iommu_domain(dev))
>>     return -EBUSY;
>>
>> @Julien, @Stefano?
> 
> I think it is OK without it, as we have a call to
> iommu_dt_device_is_assigned_locked(np) already in
> iommu_remove_dt_device?

Yes, but this would add an extra layer of protection by checking for IOMMU 
domain for this device.

~Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.