[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: Vikram Garhwal <vikram.garhwal@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 29 Aug 2023 10:51:47 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.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=Nm6YW6JUwJ6SW1eI3SE7Slvyou/+82LoRoln6JIDqzI=; b=En29RvTPN1Hke033f9SvGV7mD3qeI+eEhVf7WFvnEYEISGrwOGXBsVJtQDy1Uw4Lpmxn/uAWZ1XP5KcNvg3X4iD9KCyfL9bQZFAzXfpiebylMJ9nei2/5MRKLKe/CqaLZSLA+CMrCtgs5ZItz6mlfJB5b0ScIiKbPDzSbG5LymdW1ZFUrOPRrw3HTxrbGXkjT5d+l9ouIpHUit+T1W5+hxYqky12AzSH3vvIyYSOSXubxmWieopd9icO7foWMFvhAVjv51Y6bs0eNK5eqDVjQubtRz6Ty9XXVvtMhKZLsOlNFKMHZblzLbXCqb/uc7QuYPI2P+KJ72o1cK1VE6+GEQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V5597FGTP94/zrbo0rMA+X6BPXiP+fPME47rGWKFSB26u9y3t9MN9ezNaZzEH/SniMzzQ9Tg2jqjLm31jJEwlXcwNCGKHF2xWMzAEPb9t9VEI0KMdfbCJjpeUjAr+YZ6Bnu89sD3fLtqcsoiLO86p4I28u5h8GiAH0+TrdlZ4WWS1sAwXEN4DeHFu5J8mXvHwvKTlYTqxm9sk9laJnvFIWImS6iQa1eq+0baAqEhFd8vlCWHeeCTNkJmjoEBdNJyMsXV+2Lu7gvnoS1j6mbKTFP8YlgmwWxN+/ohf0eIqnnm61RfS0cafQTY/5Q98Rv62TODAyJ06G9ykPd7t5ITOg==
  • Cc: <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 29 Aug 2023 08:52:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


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?

~Michal



 


Rackspace

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