[PATCH 19/20] iommu/vt-d: Remove domain_update_iommu_cap()

2024-05-28 Thread Lu Baolu
The attributes of a paging domain are initialized during the allocation
process, and any attempt to attach a domain that is not compatible will
result in a failure. Therefore, there is no need to update the domain
attributes at the time of domain attachment.

Signed-off-by: Lu Baolu 
---
 drivers/iommu/intel/iommu.c | 86 +
 1 file changed, 2 insertions(+), 84 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index e9393f5c2c50..74e005b1c4b4 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -366,36 +366,6 @@ static bool iommu_paging_structure_coherency(struct 
intel_iommu *iommu)
ecap_smpwc(iommu->ecap) : ecap_coherent(iommu->ecap);
 }
 
-static void domain_update_iommu_coherency(struct dmar_domain *domain)
-{
-   struct iommu_domain_info *info;
-   struct dmar_drhd_unit *drhd;
-   struct intel_iommu *iommu;
-   bool found = false;
-   unsigned long i;
-
-   domain->iommu_coherency = true;
-   xa_for_each(>iommu_array, i, info) {
-   found = true;
-   if (!iommu_paging_structure_coherency(info->iommu)) {
-   domain->iommu_coherency = false;
-   break;
-   }
-   }
-   if (found)
-   return;
-
-   /* No hardware attached; use lowest common denominator */
-   rcu_read_lock();
-   for_each_active_iommu(iommu, drhd) {
-   if (!iommu_paging_structure_coherency(iommu)) {
-   domain->iommu_coherency = false;
-   break;
-   }
-   }
-   rcu_read_unlock();
-}
-
 static int domain_update_iommu_superpage(struct dmar_domain *domain,
 struct intel_iommu *skip)
 {
@@ -426,29 +396,6 @@ static int domain_update_iommu_superpage(struct 
dmar_domain *domain,
return fls(mask);
 }
 
-static int domain_update_device_node(struct dmar_domain *domain)
-{
-   struct device_domain_info *info;
-   int nid = NUMA_NO_NODE;
-   unsigned long flags;
-
-   spin_lock_irqsave(>lock, flags);
-   list_for_each_entry(info, >devices, link) {
-   /*
-* There could possibly be multiple device numa nodes as devices
-* within the same domain may sit behind different IOMMUs. There
-* isn't perfect answer in such situation, so we select first
-* come first served policy.
-*/
-   nid = dev_to_node(info->dev);
-   if (nid != NUMA_NO_NODE)
-   break;
-   }
-   spin_unlock_irqrestore(>lock, flags);
-
-   return nid;
-}
-
 /* Return the super pagesize bitmap if supported. */
 static unsigned long domain_super_pgsize_bitmap(struct dmar_domain *domain)
 {
@@ -466,35 +413,6 @@ static unsigned long domain_super_pgsize_bitmap(struct 
dmar_domain *domain)
return bitmap;
 }
 
-/* Some capabilities may be different across iommus */
-void domain_update_iommu_cap(struct dmar_domain *domain)
-{
-   domain_update_iommu_coherency(domain);
-   domain->iommu_superpage = domain_update_iommu_superpage(domain, NULL);
-
-   /*
-* If RHSA is missing, we should default to the device numa domain
-* as fall back.
-*/
-   if (domain->nid == NUMA_NO_NODE)
-   domain->nid = domain_update_device_node(domain);
-
-   /*
-* First-level translation restricts the input-address to a
-* canonical address (i.e., address bits 63:N have the same
-* value as address bit [N-1], where N is 48-bits with 4-level
-* paging and 57-bits with 5-level paging). Hence, skip bit
-* [N-1].
-*/
-   if (domain->use_first_level)
-   domain->domain.geometry.aperture_end = 
__DOMAIN_MAX_ADDR(domain->gaw - 1);
-   else
-   domain->domain.geometry.aperture_end = 
__DOMAIN_MAX_ADDR(domain->gaw);
-
-   domain->domain.pgsize_bitmap |= domain_super_pgsize_bitmap(domain);
-   domain_update_iotlb(domain);
-}
-
 struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
 u8 devfn, int alloc)
 {
@@ -1589,7 +1507,7 @@ int domain_attach_iommu(struct dmar_domain *domain, 
struct intel_iommu *iommu)
ret = xa_err(curr) ? : -EBUSY;
goto err_clear;
}
-   domain_update_iommu_cap(domain);
+   domain_update_iotlb(domain);
 
spin_unlock(>lock);
return 0;
@@ -1615,7 +1533,7 @@ void domain_detach_iommu(struct dmar_domain *domain, 
struct intel_iommu *iommu)
clear_bit(info->did, iommu->domain_ids);
xa_erase(>iommu_array, iommu->seq_id);
domain->nid = NUMA_NO_NODE;
-   domain_update_iommu_cap(domain);
+   domain_update_iotlb(domain);
kfree(info);

[PATCH 10/20] media: venus: firmware: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
An iommu domain is allocated in venus_firmware_init() and is attached to
core->fw.dev in the same function. Use iommu_paging_domain_alloc() to
make it explicit.

Signed-off-by: Lu Baolu 
---
 drivers/media/platform/qcom/venus/firmware.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/firmware.c 
b/drivers/media/platform/qcom/venus/firmware.c
index fe7da2b30482..66a18830e66d 100644
--- a/drivers/media/platform/qcom/venus/firmware.c
+++ b/drivers/media/platform/qcom/venus/firmware.c
@@ -316,10 +316,10 @@ int venus_firmware_init(struct venus_core *core)
 
core->fw.dev = >dev;
 
-   iommu_dom = iommu_domain_alloc(_bus_type);
-   if (!iommu_dom) {
+   iommu_dom = iommu_paging_domain_alloc(core->fw.dev);
+   if (IS_ERR(iommu_dom)) {
dev_err(core->fw.dev, "Failed to allocate iommu domain\n");
-   ret = -ENOMEM;
+   ret = PTR_ERR(iommu_dom);
goto err_unregister;
}
 
-- 
2.34.1



[PATCH 20/20] iommu/vt-d: Remove domain_update_iommu_superpage()

2024-05-28 Thread Lu Baolu
The requirement for consistent super page support across all the IOMMU
hardware in the system has been removed. In the past, if a new IOMMU
was hot-added and lacked consistent super page capability, the hot-add
process would be aborted. However, with the updated attachment semantics,
it is now permissible for the super page capability to vary among
different IOMMU hardware units.

Signed-off-by: Lu Baolu 
---
 drivers/iommu/intel/iommu.c | 39 +
 1 file changed, 1 insertion(+), 38 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 74e005b1c4b4..660d2b6c531b 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -366,36 +366,6 @@ static bool iommu_paging_structure_coherency(struct 
intel_iommu *iommu)
ecap_smpwc(iommu->ecap) : ecap_coherent(iommu->ecap);
 }
 
-static int domain_update_iommu_superpage(struct dmar_domain *domain,
-struct intel_iommu *skip)
-{
-   struct dmar_drhd_unit *drhd;
-   struct intel_iommu *iommu;
-   int mask = 0x3;
-
-   if (!intel_iommu_superpage)
-   return 0;
-
-   /* set iommu_superpage to the smallest common denominator */
-   rcu_read_lock();
-   for_each_active_iommu(iommu, drhd) {
-   if (iommu != skip) {
-   if (domain && domain->use_first_level) {
-   if (!cap_fl1gp_support(iommu->cap))
-   mask = 0x1;
-   } else {
-   mask &= cap_super_page_val(iommu->cap);
-   }
-
-   if (!mask)
-   break;
-   }
-   }
-   rcu_read_unlock();
-
-   return fls(mask);
-}
-
 /* Return the super pagesize bitmap if supported. */
 static unsigned long domain_super_pgsize_bitmap(struct dmar_domain *domain)
 {
@@ -2845,8 +2815,8 @@ int dmar_parse_one_satc(struct acpi_dmar_header *hdr, 
void *arg)
 
 static int intel_iommu_add(struct dmar_drhd_unit *dmaru)
 {
-   int sp, ret;
struct intel_iommu *iommu = dmaru->iommu;
+   int ret;
 
ret = intel_cap_audit(CAP_AUDIT_HOTPLUG_DMAR, iommu);
if (ret)
@@ -2858,13 +2828,6 @@ static int intel_iommu_add(struct dmar_drhd_unit *dmaru)
return -ENXIO;
}
 
-   sp = domain_update_iommu_superpage(NULL, iommu) - 1;
-   if (sp >= 0 && !(cap_super_page_val(iommu->cap) & (1 << sp))) {
-   pr_warn("%s: Doesn't support large page.\n",
-   iommu->name);
-   return -ENXIO;
-   }
-
/*
 * Disable translation if already enabled prior to OS handover.
 */
-- 
2.34.1



[PATCH 16/20] iommu/vt-d: Add domain_alloc_paging support

2024-05-28 Thread Lu Baolu
Move paging domain allocation code out from intel_iommu_domain_alloc().
The intel_iommu_domain_alloc()  is still remaining to allocate an identity
domain. However, it will soon disappear as we are about to convert the
identity domain to a global static one.

Signed-off-by: Lu Baolu 
---
 drivers/iommu/intel/iommu.c | 50 -
 1 file changed, 22 insertions(+), 28 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index ccde5f5972e4..eb8e08699b80 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -3708,35 +3708,8 @@ static struct dmar_domain *paging_domain_alloc(struct 
device *dev, bool first_st
 
 static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
 {
-   struct dmar_domain *dmar_domain;
-   struct iommu_domain *domain;
-
-   switch (type) {
-   case IOMMU_DOMAIN_DMA:
-   case IOMMU_DOMAIN_UNMANAGED:
-   dmar_domain = alloc_domain(type);
-   if (!dmar_domain) {
-   pr_err("Can't allocate dmar_domain\n");
-   return NULL;
-   }
-   if (md_domain_init(dmar_domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) {
-   pr_err("Domain initialization failed\n");
-   domain_exit(dmar_domain);
-   return NULL;
-   }
-
-   domain = _domain->domain;
-   domain->geometry.aperture_start = 0;
-   domain->geometry.aperture_end   =
-   __DOMAIN_MAX_ADDR(dmar_domain->gaw);
-   domain->geometry.force_aperture = true;
-
-   return domain;
-   case IOMMU_DOMAIN_IDENTITY:
+   if (type == IOMMU_DOMAIN_IDENTITY)
return _domain->domain;
-   default:
-   return NULL;
-   }
 
return NULL;
 }
@@ -3791,6 +3764,26 @@ intel_iommu_domain_alloc_user(struct device *dev, u32 
flags,
return domain;
 }
 
+static struct iommu_domain *intel_iommu_domain_alloc_paging(struct device *dev)
+{
+   struct dmar_domain *dmar_domain;
+   struct device_domain_info *info;
+   struct intel_iommu *iommu;
+
+   /* Do not support the legacy iommu_domain_alloc() interface. */
+   if (!dev)
+   return ERR_PTR(-ENODEV);
+
+   info = dev_iommu_priv_get(dev);
+   iommu = info->iommu;
+   dmar_domain = paging_domain_alloc(dev,
+   sm_supported(iommu) && ecap_flts(iommu->ecap));
+   if (IS_ERR(dmar_domain))
+   return ERR_CAST(dmar_domain);
+
+   return _domain->domain;
+}
+
 static void intel_iommu_domain_free(struct iommu_domain *domain)
 {
struct dmar_domain *dmar_domain = to_dmar_domain(domain);
@@ -4650,6 +4643,7 @@ const struct iommu_ops intel_iommu_ops = {
.domain_alloc   = intel_iommu_domain_alloc,
.domain_alloc_user  = intel_iommu_domain_alloc_user,
.domain_alloc_sva   = intel_svm_domain_alloc,
+   .domain_alloc_paging= intel_iommu_domain_alloc_paging,
.probe_device   = intel_iommu_probe_device,
.release_device = intel_iommu_release_device,
.get_resv_regions   = intel_iommu_get_resv_regions,
-- 
2.34.1



[PATCH 13/20] remoteproc: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
An iommu domain is allocated in rproc_enable_iommu() and is attached to
rproc->dev.parent in the same function.

Use iommu_paging_domain_alloc() to make it explicit.

Signed-off-by: Lu Baolu 
---
 drivers/remoteproc/remoteproc_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c 
b/drivers/remoteproc/remoteproc_core.c
index f276956f2c5c..eb66f78ec8b7 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -109,10 +109,10 @@ static int rproc_enable_iommu(struct rproc *rproc)
return 0;
}
 
-   domain = iommu_domain_alloc(dev->bus);
-   if (!domain) {
+   domain = iommu_paging_domain_alloc(dev);
+   if (IS_ERR(domain)) {
dev_err(dev, "can't alloc iommu domain\n");
-   return -ENOMEM;
+   return PTR_ERR(domain);
}
 
iommu_set_fault_handler(domain, rproc_iommu_fault, rproc);
-- 
2.34.1



[PATCH 18/20] iommu/vt-d: Enhance compatibility check for paging domain attach

2024-05-28 Thread Lu Baolu
The driver now supports domain_alloc_paging, ensuring that a valid device
pointer is provided whenever a paging domain is allocated. Additionally,
the dmar_domain attributes are set up at the time of allocation.

Consistent with the established semantics in the IOMMU core, if a domain is
attached to a device and found to be incompatible with the IOMMU hardware
capabilities, the operation will return an -EINVAL error. This implicitly
advises the caller to allocate a new domain for the device and attempt the
domain attachment again.

Signed-off-by: Lu Baolu 
---
 drivers/iommu/intel/iommu.c | 39 ++---
 drivers/iommu/intel/pasid.c | 28 +-
 2 files changed, 20 insertions(+), 47 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 693a6d7c79ed..e9393f5c2c50 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -3826,27 +3826,26 @@ int prepare_domain_attach_device(struct iommu_domain 
*domain,
if (domain->dirty_ops && !ssads_supported(iommu))
return -EINVAL;
 
-   /* check if this iommu agaw is sufficient for max mapped address */
-   addr_width = agaw_to_width(iommu->agaw);
-   if (addr_width > cap_mgaw(iommu->cap))
-   addr_width = cap_mgaw(iommu->cap);
-
-   if (dmar_domain->max_addr > (1LL << addr_width))
+   if (dmar_domain->iommu_coherency !=
+   iommu_paging_structure_coherency(iommu))
return -EINVAL;
-   dmar_domain->gaw = addr_width;
-
-   /*
-* Knock out extra levels of page tables if necessary
-*/
-   while (iommu->agaw < dmar_domain->agaw) {
-   struct dma_pte *pte;
-
-   pte = dmar_domain->pgd;
-   if (dma_pte_present(pte)) {
-   dmar_domain->pgd = phys_to_virt(dma_pte_addr(pte));
-   iommu_free_page(pte);
-   }
-   dmar_domain->agaw--;
+
+   if (domain->type & __IOMMU_DOMAIN_PAGING) {
+   if (dmar_domain->iommu_superpage !=
+   iommu_superpage_capability(iommu, 
dmar_domain->use_first_level))
+   return -EINVAL;
+
+   if (dmar_domain->use_first_level &&
+   (!sm_supported(iommu) || 
!ecap_flts(iommu->ecap)))
+   return -EINVAL;
+
+   /* check if this iommu agaw is sufficient for max mapped 
address */
+   addr_width = agaw_to_width(iommu->agaw);
+   if (addr_width > cap_mgaw(iommu->cap))
+   addr_width = cap_mgaw(iommu->cap);
+
+   if (dmar_domain->gaw > addr_width || dmar_domain->agaw > 
iommu->agaw)
+   return -EINVAL;
}
 
if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev) &&
diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
index abce19e2ad6f..573e1b8e3cfb 100644
--- a/drivers/iommu/intel/pasid.c
+++ b/drivers/iommu/intel/pasid.c
@@ -345,25 +345,6 @@ int intel_pasid_setup_first_level(struct intel_iommu 
*iommu,
return 0;
 }
 
-/*
- * Skip top levels of page tables for iommu which has less agaw
- * than default. Unnecessary for PT mode.
- */
-static int iommu_skip_agaw(struct dmar_domain *domain,
-  struct intel_iommu *iommu,
-  struct dma_pte **pgd)
-{
-   int agaw;
-
-   for (agaw = domain->agaw; agaw > iommu->agaw; agaw--) {
-   *pgd = phys_to_virt(dma_pte_addr(*pgd));
-   if (!dma_pte_present(*pgd))
-   return -EINVAL;
-   }
-
-   return agaw;
-}
-
 /*
  * Set up the scalable mode pasid entry for second only translation type.
  */
@@ -374,7 +355,6 @@ int intel_pasid_setup_second_level(struct intel_iommu 
*iommu,
struct pasid_entry *pte;
struct dma_pte *pgd;
u64 pgd_val;
-   int agaw;
u16 did;
 
/*
@@ -388,12 +368,6 @@ int intel_pasid_setup_second_level(struct intel_iommu 
*iommu,
}
 
pgd = domain->pgd;
-   agaw = iommu_skip_agaw(domain, iommu, );
-   if (agaw < 0) {
-   dev_err(dev, "Invalid domain page table\n");
-   return -EINVAL;
-   }
-
pgd_val = virt_to_phys(pgd);
did = domain_id_iommu(domain, iommu);
 
@@ -412,7 +386,7 @@ int intel_pasid_setup_second_level(struct intel_iommu 
*iommu,
pasid_clear_entry(pte);
pasid_set_domain_id(pte, did);
pasid_set_slptr(pte, pgd_val);
-   pasid_set_address_width(pte, agaw);
+   pasid_set_address_width(pte, domain->agaw);
pasid_set_translation_type(pte, PASID_ENTRY_PGTT_SL_ONLY);
pasid_set_fault_enable(pte);
pasid_set_page_snoop(pte, !!ecap_smpwc(iommu->ecap));
-- 
2.34.1



[PATCH 15/20] iommu/vt-d: Add helper to allocate paging domain

2024-05-28 Thread Lu Baolu
The domain_alloc_user operation is currently implemented by allocating a
paging domain using iommu_domain_alloc(). This is because it needs to fully
initialize the domain before return. Add a helper to do this to avoid using
iommu_domain_alloc().

Signed-off-by: Lu Baolu 
---
 drivers/iommu/intel/iommu.c | 87 +
 1 file changed, 78 insertions(+), 9 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 2e9811bf2a4e..ccde5f5972e4 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -3633,6 +3633,79 @@ static struct iommu_domain blocking_domain = {
}
 };
 
+static int iommu_superpage_capability(struct intel_iommu *iommu, bool 
first_stage)
+{
+   if (!intel_iommu_superpage)
+   return 0;
+
+   if (first_stage)
+   return cap_fl1gp_support(iommu->cap) ? 2 : 1;
+
+   return fls(cap_super_page_val(iommu->cap));
+}
+
+static struct dmar_domain *paging_domain_alloc(struct device *dev, bool 
first_stage)
+{
+   struct device_domain_info *info = dev_iommu_priv_get(dev);
+   struct intel_iommu *iommu = info->iommu;
+   struct dmar_domain *domain;
+   int addr_width;
+
+   domain = kzalloc(sizeof(*domain), GFP_KERNEL);
+   if (!domain)
+   return ERR_PTR(-ENOMEM);
+
+   INIT_LIST_HEAD(>devices);
+   INIT_LIST_HEAD(>dev_pasids);
+   INIT_LIST_HEAD(>cache_tags);
+   spin_lock_init(>lock);
+   spin_lock_init(>cache_lock);
+   xa_init(>iommu_array);
+
+   domain->nid = dev_to_node(dev);
+   domain->has_iotlb_device = info->ats_enabled;
+   domain->use_first_level = first_stage;
+
+   /* calculate the address width */
+   addr_width = agaw_to_width(iommu->agaw);
+   if (addr_width > cap_mgaw(iommu->cap))
+   addr_width = cap_mgaw(iommu->cap);
+   domain->gaw = addr_width;
+   domain->agaw = iommu->agaw;
+   domain->max_addr = __DOMAIN_MAX_ADDR(addr_width);
+
+   /* iommu memory access coherency */
+   domain->iommu_coherency = iommu_paging_structure_coherency(iommu);
+
+   /* pagesize bitmap */
+   domain->domain.pgsize_bitmap = SZ_4K;
+   domain->iommu_superpage = iommu_superpage_capability(iommu, 
first_stage);
+   domain->domain.pgsize_bitmap |= domain_super_pgsize_bitmap(domain);
+
+   /*
+* IOVA aperture: First-level translation restricts the input-address
+* to a canonical address (i.e., address bits 63:N have the same value
+* as address bit [N-1], where N is 48-bits with 4-level paging and
+* 57-bits with 5-level paging). Hence, skip bit [N-1].
+*/
+   domain->domain.geometry.force_aperture = true;
+   domain->domain.geometry.aperture_start = 0;
+   if (first_stage)
+   domain->domain.geometry.aperture_end = 
__DOMAIN_MAX_ADDR(domain->gaw - 1);
+   else
+   domain->domain.geometry.aperture_end = 
__DOMAIN_MAX_ADDR(domain->gaw);
+
+   /* always allocate the top pgd */
+   domain->pgd = iommu_alloc_page_node(domain->nid, GFP_KERNEL);
+   if (!domain->pgd) {
+   kfree(domain);
+   return ERR_PTR(-ENOMEM);
+   }
+   domain_flush_cache(domain, domain->pgd, PAGE_SIZE);
+
+   return domain;
+}
+
 static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
 {
struct dmar_domain *dmar_domain;
@@ -3695,15 +3768,11 @@ intel_iommu_domain_alloc_user(struct device *dev, u32 
flags,
if (user_data || (dirty_tracking && !ssads_supported(iommu)))
return ERR_PTR(-EOPNOTSUPP);
 
-   /*
-* domain_alloc_user op needs to fully initialize a domain before
-* return, so uses iommu_domain_alloc() here for simple.
-*/
-   domain = iommu_domain_alloc(dev->bus);
-   if (!domain)
-   return ERR_PTR(-ENOMEM);
-
-   dmar_domain = to_dmar_domain(domain);
+   /* Do not use first stage for user domain translation. */
+   dmar_domain = paging_domain_alloc(dev, false);
+   if (IS_ERR(dmar_domain))
+   return ERR_CAST(dmar_domain);
+   domain = _domain->domain;
 
if (nested_parent) {
dmar_domain->nested_parent = true;
-- 
2.34.1



[PATCH 17/20] iommu/vt-d: Simplify compatibility check for identity domain

2024-05-28 Thread Lu Baolu
Currently, the identity domain attachment follows the same path as the
paging domain attachment and is subject to the same compatibility checks
as a normal paging domain. However, this level of check is unnecessary
for the identity domain since it only requires the hardware to support
passthrough mode, which is a given for modern hardware.

On the early VT-d platforms, where hardware passthrough mode is not yet
supported, the identity domain is supported by a makeshift paging domain
with the entire system memory 1:1 mapped. For such early hardware, the
appropriate domain type should be returned in device_def_domain_type(),
and the identity domain should be simplified in compatibility checks.

The identity domain workaround in prepare_domain_attach_device() is just
temporary and should be removed once the identity domain is converted to
have its own dedicated attachment path.

Signed-off-by: Lu Baolu 
---
 drivers/iommu/intel/iommu.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index eb8e08699b80..693a6d7c79ed 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2190,6 +2190,16 @@ static bool device_rmrr_is_relaxable(struct device *dev)
  */
 static int device_def_domain_type(struct device *dev)
 {
+   struct device_domain_info *info = dev_iommu_priv_get(dev);
+   struct intel_iommu *iommu = info->iommu;
+
+   /*
+* Hardware does not support the passthrough translation mode.
+* Always use a dynamaic mapping domain.
+*/
+   if (!ecap_pass_through(iommu->ecap))
+   return IOMMU_DOMAIN_DMA;
+
if (dev_is_pci(dev)) {
struct pci_dev *pdev = to_pci_dev(dev);
 
@@ -3802,6 +3812,14 @@ int prepare_domain_attach_device(struct iommu_domain 
*domain,
struct intel_iommu *iommu = info->iommu;
int addr_width;
 
+   /*
+* This is a temporary solution as the identity domain attachment
+* goes through this path as well. It should be removed once the
+* identity domain has its own attach path.
+*/
+   if (domain->type == IOMMU_DOMAIN_IDENTITY)
+   return ecap_pass_through(iommu->ecap) ? 0 : -EOPNOTSUPP;
+
if (dmar_domain->force_snooping && !ecap_sc_support(iommu->ecap))
return -EINVAL;
 
-- 
2.34.1



[PATCH 06/20] drm/msm: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
The domain allocated in msm_iommu_new() is for the @dev. Replace
iommu_domain_alloc() with iommu_paging_domain_alloc() to make it explicit.

Update msm_iommu_new() to always return ERR_PTR in failure cases instead
of NULL.

Signed-off-by: Lu Baolu 
---
 drivers/gpu/drm/msm/msm_iommu.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index d5512037c38b..f7e28d4b5f62 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -407,9 +407,9 @@ struct msm_mmu *msm_iommu_new(struct device *dev, unsigned 
long quirks)
struct msm_iommu *iommu;
int ret;
 
-   domain = iommu_domain_alloc(dev->bus);
-   if (!domain)
-   return NULL;
+   domain = iommu_paging_domain_alloc(dev);
+   if (IS_ERR(domain))
+   return ERR_CAST(domain);
 
iommu_set_pgtable_quirks(domain, quirks);
 
@@ -441,7 +441,7 @@ struct msm_mmu *msm_iommu_gpu_new(struct device *dev, 
struct msm_gpu *gpu, unsig
struct msm_mmu *mmu;
 
mmu = msm_iommu_new(dev, quirks);
-   if (IS_ERR_OR_NULL(mmu))
+   if (IS_ERR(mmu))
return mmu;
 
iommu = to_msm_iommu(mmu);
-- 
2.34.1



[PATCH 04/20] vhost-vdpa: Use iommu_user_domain_alloc()

2024-05-28 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_user_domain_alloc().

Signed-off-by: Lu Baolu 
---
 drivers/vhost/vdpa.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 63a53680a85c..7784218fd9d2 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1312,26 +1312,21 @@ static int vhost_vdpa_alloc_domain(struct vhost_vdpa *v)
struct vdpa_device *vdpa = v->vdpa;
const struct vdpa_config_ops *ops = vdpa->config;
struct device *dma_dev = vdpa_get_dma_dev(vdpa);
-   const struct bus_type *bus;
int ret;
 
/* Device want to do DMA by itself */
if (ops->set_map || ops->dma_map)
return 0;
 
-   bus = dma_dev->bus;
-   if (!bus)
-   return -EFAULT;
-
if (!device_iommu_capable(dma_dev, IOMMU_CAP_CACHE_COHERENCY)) {
dev_warn_once(>dev,
  "Failed to allocate domain, device is not IOMMU 
cache coherent capable\n");
return -ENOTSUPP;
}
 
-   v->domain = iommu_domain_alloc(bus);
-   if (!v->domain)
-   return -EIO;
+   v->domain = iommu_user_domain_alloc(dma_dev, 0);
+   if (IS_ERR(v->domain))
+   return PTR_ERR(v->domain);
 
ret = iommu_attach_device(v->domain, dma_dev);
if (ret)
-- 
2.34.1



[PATCH 11/20] ath10k: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
An iommu domain is allocated in ath10k_fw_init() and is attached to
ar_snoc->fw.dev in the same function. Use iommu_paging_domain_alloc() to
make it explicit.

Signed-off-by: Lu Baolu 
---
 drivers/net/wireless/ath/ath10k/snoc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 8530550cf5df..0fe47d51013c 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1635,10 +1635,10 @@ static int ath10k_fw_init(struct ath10k *ar)
 
ar_snoc->fw.dev = >dev;
 
-   iommu_dom = iommu_domain_alloc(_bus_type);
-   if (!iommu_dom) {
+   iommu_dom = iommu_paging_domain_alloc(ar_snoc->fw.dev);
+   if (IS_ERR(iommu_dom)) {
ath10k_err(ar, "failed to allocate iommu domain\n");
-   ret = -ENOMEM;
+   ret = PTR_ERR(iommu_dom);
goto err_unregister;
}
 
-- 
2.34.1



[PATCH 14/20] soc/fsl/qbman: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
An iommu domain is allocated in portal_set_cpu() and is attached to
pcfg->dev in the same function.

Use iommu_paging_domain_alloc() to make it explicit.

Signed-off-by: Lu Baolu 
---
 drivers/soc/fsl/qbman/qman_portal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/fsl/qbman/qman_portal.c 
b/drivers/soc/fsl/qbman/qman_portal.c
index e23b60618c1a..91f17cea3744 100644
--- a/drivers/soc/fsl/qbman/qman_portal.c
+++ b/drivers/soc/fsl/qbman/qman_portal.c
@@ -48,8 +48,8 @@ static void portal_set_cpu(struct qm_portal_config *pcfg, int 
cpu)
struct device *dev = pcfg->dev;
int ret;
 
-   pcfg->iommu_domain = iommu_domain_alloc(_bus_type);
-   if (!pcfg->iommu_domain) {
+   pcfg->iommu_domain = iommu_paging_domain_alloc(dev);
+   if (IS_ERR(pcfg->iommu_domain)) {
dev_err(dev, "%s(): iommu_domain_alloc() failed", __func__);
goto no_iommu;
}
-- 
2.34.1



[PATCH 09/20] media: nvidia: tegra: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
An iommu domain is allocated in tegra_vde_iommu_init() and is attached to
vde->dev. Use iommu_paging_domain_alloc() to make it explicit.

Signed-off-by: Lu Baolu 
---
 drivers/media/platform/nvidia/tegra-vde/iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/nvidia/tegra-vde/iommu.c 
b/drivers/media/platform/nvidia/tegra-vde/iommu.c
index 5521ed3e465f..5a41b5364238 100644
--- a/drivers/media/platform/nvidia/tegra-vde/iommu.c
+++ b/drivers/media/platform/nvidia/tegra-vde/iommu.c
@@ -78,9 +78,9 @@ int tegra_vde_iommu_init(struct tegra_vde *vde)
arm_iommu_release_mapping(mapping);
}
 #endif
-   vde->domain = iommu_domain_alloc(_bus_type);
-   if (!vde->domain) {
-   err = -ENOMEM;
+   vde->domain = iommu_paging_domain_alloc(dev);
+   if (IS_ERR(vde->domain)) {
+   err = PTR_ERR(vde->domain);
goto put_group;
}
 
-- 
2.34.1



[PATCH 00/20] iommu: Refactoring domain allocation interface

2024-05-28 Thread Lu Baolu
The IOMMU subsystem has undergone some changes, including the removal
of iommu_ops from the bus structure. Consequently, the existing domain
allocation interface, which relies on a bus type argument, is no longer
relevant:

struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)

This series is designed to refactor the use of this interface. It
proposes two new interfaces to replace iommu_domain_alloc():

- iommu_user_domain_alloc(): This interface is intended for allocating
  iommu domains managed by userspace for device passthrough scenarios,
  such as those used by iommufd, vfio, and vdpa. It clearly indicates
  that the domain is for user-managed device DMA.

  If an IOMMU driver does not implement iommu_ops->domain_alloc_user,
  this interface will rollback to the generic paging domain allocation.

- iommu_paging_domain_alloc(): This interface is for allocating iommu
  domains managed by kernel drivers for kernel DMA purposes. It takes a
  device pointer as a parameter, which better reflects the current
  design of the IOMMU subsystem.

The majority of device drivers currently using iommu_domain_alloc() do
so to allocate a domain for a specific device and then attach that
domain to the device. These cases can be straightforwardly migrated to
the new interfaces.

However, there are some drivers with more complex use cases that do
not fit neatly into this new scheme. For example:

$ git grep "= iommu_domain_alloc"
arch/arm/mm/dma-mapping.c:  mapping->domain = iommu_domain_alloc(bus);
drivers/gpu/drm/rockchip/rockchip_drm_drv.c:private->domain = 
iommu_domain_alloc(private->iommu_dev->bus);
drivers/gpu/drm/tegra/drm.c:tegra->domain = 
iommu_domain_alloc(_bus_type);
drivers/infiniband/hw/usnic/usnic_uiom.c:   pd->domain = domain = 
iommu_domain_alloc(dev->bus);

This series leave those cases unchanged and keep iommu_domain_alloc()
for their usage. But new drivers should not use it anymore.

The whole series is also available on GitHub:
https://github.com/LuBaolu/intel-iommu/commits/iommu-domain-allocation-refactor-v1

Lu Baolu (20):
  iommu: Add iommu_user_domain_alloc() interface
  iommufd: Use iommu_user_domain_alloc()
  vfio/type1: Use iommu_paging_domain_alloc()
  vhost-vdpa: Use iommu_user_domain_alloc()
  iommu: Add iommu_paging_domain_alloc() interface
  drm/msm: Use iommu_paging_domain_alloc()
  drm/nouveau/tegra: Use iommu_paging_domain_alloc()
  gpu: host1x: Use iommu_paging_domain_alloc()
  media: nvidia: tegra: Use iommu_paging_domain_alloc()
  media: venus: firmware: Use iommu_paging_domain_alloc()
  ath10k: Use iommu_paging_domain_alloc()
  wifi: ath11k: Use iommu_paging_domain_alloc()
  remoteproc: Use iommu_paging_domain_alloc()
  soc/fsl/qbman: Use iommu_paging_domain_alloc()
  iommu/vt-d: Add helper to allocate paging domain
  iommu/vt-d: Add domain_alloc_paging support
  iommu/vt-d: Simplify compatibility check for identity domain
  iommu/vt-d: Enhance compatibility check for paging domain attach
  iommu/vt-d: Remove domain_update_iommu_cap()
  iommu/vt-d: Remove domain_update_iommu_superpage()

 include/linux/iommu.h |  12 +
 drivers/gpu/drm/msm/msm_iommu.c   |   8 +-
 .../drm/nouveau/nvkm/engine/device/tegra.c|   4 +-
 drivers/gpu/host1x/dev.c  |   6 +-
 drivers/iommu/intel/iommu.c   | 319 --
 drivers/iommu/intel/pasid.c   |  28 +-
 drivers/iommu/iommu.c |  62 
 drivers/iommu/iommufd/hw_pagetable.c  |  20 +-
 .../media/platform/nvidia/tegra-vde/iommu.c   |   6 +-
 drivers/media/platform/qcom/venus/firmware.c  |   6 +-
 drivers/net/wireless/ath/ath10k/snoc.c|   6 +-
 drivers/net/wireless/ath/ath11k/ahb.c |   6 +-
 drivers/remoteproc/remoteproc_core.c  |   6 +-
 drivers/soc/fsl/qbman/qman_portal.c   |   4 +-
 drivers/vfio/vfio_iommu_type1.c   |   7 +-
 drivers/vhost/vdpa.c  |  11 +-
 16 files changed, 253 insertions(+), 258 deletions(-)

-- 
2.34.1



[PATCH 08/20] gpu: host1x: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
An iommu domain is allocated in host1x_iommu_attach() and is attached to
host->dev. Use iommu_paging_domain_alloc() to make it explicit.

Signed-off-by: Lu Baolu 
---
 drivers/gpu/host1x/dev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 3a0aaa68ac8d..46a2447c1124 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -404,9 +404,9 @@ static struct iommu_domain *host1x_iommu_attach(struct 
host1x *host)
if (err < 0)
goto put_group;
 
-   host->domain = iommu_domain_alloc(_bus_type);
-   if (!host->domain) {
-   err = -ENOMEM;
+   host->domain = iommu_paging_domain_alloc(host->dev);
+   if (IS_ERR(host->domain)) {
+   err = PTR_ERR(host->domain);
goto put_cache;
}
 
-- 
2.34.1



[PATCH 12/20] wifi: ath11k: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
An iommu domain is allocated in ath11k_ahb_fw_resources_init() and is
attached to ab_ahb->fw.dev in the same function.

Use iommu_paging_domain_alloc() to make it explicit.

Signed-off-by: Lu Baolu 
---
 drivers/net/wireless/ath/ath11k/ahb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/ahb.c 
b/drivers/net/wireless/ath/ath11k/ahb.c
index ca0f17ddebba..a469647719f9 100644
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -1001,10 +1001,10 @@ static int ath11k_ahb_fw_resources_init(struct 
ath11k_base *ab)
 
ab_ahb->fw.dev = >dev;
 
-   iommu_dom = iommu_domain_alloc(_bus_type);
-   if (!iommu_dom) {
+   iommu_dom = iommu_paging_domain_alloc(ab_ahb->fw.dev);
+   if (IS_ERR(iommu_dom)) {
ath11k_err(ab, "failed to allocate iommu domain\n");
-   ret = -ENOMEM;
+   ret = PTR_ERR(iommu_dom);
goto err_unregister;
}
 
-- 
2.34.1



[PATCH 07/20] drm/nouveau/tegra: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
In nvkm_device_tegra_probe_iommu(), a paging domain is allocated for @dev
and attached to it on success. Use iommu_paging_domain_alloc() to make it
explicit.

Signed-off-by: Lu Baolu 
---
 drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c 
b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
index 87caa4a72921..763c4c2925f9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
@@ -120,8 +120,8 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra 
*tdev)
mutex_init(>iommu.mutex);
 
if (device_iommu_mapped(dev)) {
-   tdev->iommu.domain = iommu_domain_alloc(_bus_type);
-   if (!tdev->iommu.domain)
+   tdev->iommu.domain = iommu_paging_domain_alloc(dev);
+   if (IS_ERR(tdev->iommu.domain))
goto error;
 
/*
-- 
2.34.1



[PATCH 05/20] iommu: Add iommu_paging_domain_alloc() interface

2024-05-28 Thread Lu Baolu
Commit <17de3f5fdd35> ("iommu: Retire bus ops") removes iommu ops from
bus. The iommu subsystem no longer relies on bus for operations. So the
bus parameter in iommu_domain_alloc() is no longer relevant.

Add a new interface named iommu_paging_domain_alloc(), which explicitly
indicates the allocation of a paging domain for DMA managed by a kernel
driver. The new interface takes a device pointer as its parameter, that
better aligns with the current iommu subsystem.

Signed-off-by: Lu Baolu 
---
 include/linux/iommu.h |  6 ++
 drivers/iommu/iommu.c | 20 
 2 files changed, 26 insertions(+)

diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 6648b2415474..16401de7802d 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -781,6 +781,7 @@ extern bool device_iommu_capable(struct device *dev, enum 
iommu_cap cap);
 extern bool iommu_group_has_isolated_msi(struct iommu_group *group);
 extern struct iommu_domain *iommu_domain_alloc(const struct bus_type *bus);
 struct iommu_domain *iommu_user_domain_alloc(struct device *dev, u32 flags);
+struct iommu_domain *iommu_paging_domain_alloc(struct device *dev);
 extern void iommu_domain_free(struct iommu_domain *domain);
 extern int iommu_attach_device(struct iommu_domain *domain,
   struct device *dev);
@@ -1092,6 +1093,11 @@ static inline struct iommu_domain 
*iommu_user_domain_alloc(struct device *dev, u
return ERR_PTR(-ENODEV);
 }
 
+static inline struct iommu_domain *iommu_paging_domain_alloc(struct device 
*dev)
+{
+   return ERR_PTR(-ENODEV);
+}
+
 static inline void iommu_domain_free(struct iommu_domain *domain)
 {
 }
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index f1416892ef8e..7df4a021b040 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2016,6 +2016,10 @@ static int __iommu_domain_alloc_dev(struct device *dev, 
void *data)
return 0;
 }
 
+/*
+ * The iommu ops in bus has been retired. Do not use this interface in
+ * new drivers.
+ */
 struct iommu_domain *iommu_domain_alloc(const struct bus_type *bus)
 {
const struct iommu_ops *ops = NULL;
@@ -2074,6 +2078,22 @@ struct iommu_domain *iommu_user_domain_alloc(struct 
device *dev, u32 flags)
 }
 EXPORT_SYMBOL_GPL(iommu_user_domain_alloc);
 
+/**
+ * iommu_paging_domain_alloc() - Allocate a paging domain
+ * @dev: device for which the domain is allocated
+ *
+ * Allocate a paging domain which will be managed by a kernel driver. Return
+ * allocated domain if successful, or a ERR pointer for failure.
+ */
+struct iommu_domain *iommu_paging_domain_alloc(struct device *dev)
+{
+   if (!dev_has_iommu(dev))
+   return ERR_PTR(-ENODEV);
+
+   return __iommu_domain_alloc(dev_iommu_ops(dev), dev, 
IOMMU_DOMAIN_UNMANAGED);
+}
+EXPORT_SYMBOL_GPL(iommu_paging_domain_alloc);
+
 void iommu_domain_free(struct iommu_domain *domain)
 {
if (domain->type == IOMMU_DOMAIN_SVA)
-- 
2.34.1



[PATCH 03/20] vfio/type1: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_user_domain_alloc().

Signed-off-by: Lu Baolu 
---
 drivers/vfio/vfio_iommu_type1.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 3a0218171cfa..1d553f7f7c26 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -2135,7 +2135,7 @@ static int vfio_iommu_domain_alloc(struct device *dev, 
void *data)
 {
struct iommu_domain **domain = data;
 
-   *domain = iommu_domain_alloc(dev->bus);
+   *domain = iommu_user_domain_alloc(dev, 0);
return 1; /* Don't iterate */
 }
 
@@ -2192,11 +2192,12 @@ static int vfio_iommu_type1_attach_group(void 
*iommu_data,
 * us a representative device for the IOMMU API call. We don't actually
 * want to iterate beyond the first device (if any).
 */
-   ret = -EIO;
iommu_group_for_each_dev(iommu_group, >domain,
 vfio_iommu_domain_alloc);
-   if (!domain->domain)
+   if (IS_ERR(domain->domain)) {
+   ret = PTR_ERR(domain->domain);
goto out_free_domain;
+   }
 
if (iommu->nesting) {
ret = iommu_enable_nesting(domain->domain);
-- 
2.34.1



[PATCH 01/20] iommu: Add iommu_user_domain_alloc() interface

2024-05-28 Thread Lu Baolu
Commit <909f4abd1097> ("iommu: Add new iommu op to create domains owned
by userspace") added a dedicated iommu op to allocate a user domain.
While IOMMUFD has already made use of this callback, other frameworks
like vfio/type1 and vDPA still use the paging domain allocation interface.

Add a new interface named iommu_user_domain_alloc(), which indicates the
allocation of a domain for device DMA managed by user space driver. All
device passthrough frameworks could use this interface for their domain
allocation.

Although it is expected that all iommu drivers could implement their own
domain_alloc_user ops, most drivers haven't implemented it yet. Rollback
to the paging domain allocation interface if the iommu driver hasn't
implemented this op yet.

Signed-off-by: Lu Baolu 
---
 include/linux/iommu.h |  6 ++
 drivers/iommu/iommu.c | 42 ++
 2 files changed, 48 insertions(+)

diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 7bc8dff7cf6d..6648b2415474 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -780,6 +780,7 @@ extern bool iommu_present(const struct bus_type *bus);
 extern bool device_iommu_capable(struct device *dev, enum iommu_cap cap);
 extern bool iommu_group_has_isolated_msi(struct iommu_group *group);
 extern struct iommu_domain *iommu_domain_alloc(const struct bus_type *bus);
+struct iommu_domain *iommu_user_domain_alloc(struct device *dev, u32 flags);
 extern void iommu_domain_free(struct iommu_domain *domain);
 extern int iommu_attach_device(struct iommu_domain *domain,
   struct device *dev);
@@ -1086,6 +1087,11 @@ static inline struct iommu_domain 
*iommu_domain_alloc(const struct bus_type *bus
return NULL;
 }
 
+static inline struct iommu_domain *iommu_user_domain_alloc(struct device *dev, 
u32 flags)
+{
+   return ERR_PTR(-ENODEV);
+}
+
 static inline void iommu_domain_free(struct iommu_domain *domain)
 {
 }
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 9df7cc75c1bc..f1416892ef8e 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2032,6 +2032,48 @@ struct iommu_domain *iommu_domain_alloc(const struct 
bus_type *bus)
 }
 EXPORT_SYMBOL_GPL(iommu_domain_alloc);
 
+/**
+ * iommu_user_domain_alloc() - Allocate a user domain
+ * @dev: device for which the domain is allocated
+ * @flags: iommufd_hwpt_alloc_flags defined in uapi/linux/iommufd.h
+ *
+ * Allocate a user domain which will be managed by a userspace driver. Return
+ * allocated domain if successful, or a ERR pointer for failure.
+ */
+struct iommu_domain *iommu_user_domain_alloc(struct device *dev, u32 flags)
+{
+   struct iommu_domain *domain;
+   const struct iommu_ops *ops;
+
+   if (!dev_has_iommu(dev))
+   return ERR_PTR(-ENODEV);
+
+   ops = dev_iommu_ops(dev);
+   if (ops->domain_alloc_user) {
+   domain = ops->domain_alloc_user(dev, flags, NULL, NULL);
+   if (IS_ERR(domain))
+   return domain;
+
+   domain->type = IOMMU_DOMAIN_UNMANAGED;
+   domain->owner = ops;
+   domain->pgsize_bitmap = ops->pgsize_bitmap;
+   domain->ops = ops->default_domain_ops;
+
+   return domain;
+   }
+
+   /*
+* The iommu driver doesn't support domain_alloc_user callback.
+* Rollback to a UNMANAGED paging domain which doesn't support
+* the allocation flags.
+*/
+   if (flags)
+   return ERR_PTR(-EOPNOTSUPP);
+
+   return __iommu_domain_alloc(ops, dev, IOMMU_DOMAIN_UNMANAGED);
+}
+EXPORT_SYMBOL_GPL(iommu_user_domain_alloc);
+
 void iommu_domain_free(struct iommu_domain *domain)
 {
if (domain->type == IOMMU_DOMAIN_SVA)
-- 
2.34.1



[PATCH 02/20] iommufd: Use iommu_user_domain_alloc()

2024-05-28 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_user_domain_alloc().

Signed-off-by: Lu Baolu 
---
 drivers/iommu/iommufd/hw_pagetable.c | 20 +---
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/iommu/iommufd/hw_pagetable.c 
b/drivers/iommu/iommufd/hw_pagetable.c
index 33d142f8057d..ada05fccb36a 100644
--- a/drivers/iommu/iommufd/hw_pagetable.c
+++ b/drivers/iommu/iommufd/hw_pagetable.c
@@ -127,21 +127,11 @@ iommufd_hwpt_paging_alloc(struct iommufd_ctx *ictx, 
struct iommufd_ioas *ioas,
hwpt_paging->ioas = ioas;
hwpt_paging->nest_parent = flags & IOMMU_HWPT_ALLOC_NEST_PARENT;
 
-   if (ops->domain_alloc_user) {
-   hwpt->domain = ops->domain_alloc_user(idev->dev, flags, NULL,
- user_data);
-   if (IS_ERR(hwpt->domain)) {
-   rc = PTR_ERR(hwpt->domain);
-   hwpt->domain = NULL;
-   goto out_abort;
-   }
-   hwpt->domain->owner = ops;
-   } else {
-   hwpt->domain = iommu_domain_alloc(idev->dev->bus);
-   if (!hwpt->domain) {
-   rc = -ENOMEM;
-   goto out_abort;
-   }
+   hwpt->domain = iommu_user_domain_alloc(idev->dev, flags);
+   if (IS_ERR(hwpt->domain)) {
+   rc = PTR_ERR(hwpt->domain);
+   hwpt->domain = NULL;
+   goto out_abort;
}
 
/*
-- 
2.34.1



[drm-misc:drm-misc-next 11/29] ERROR: modpost: "drm_hdmi_compute_mode_clock" [drivers/gpu/drm/display/drm_display_helper.ko] undefined!

2024-05-28 Thread kernel test robot
tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head:   336dca397dcefc5d7436be1fee3c814ed6512996
commit: f035f4097f1e0a35a457b72427bb0c06ca0c81c4 [11/29] drm/connector: hdmi: 
Calculate TMDS character rate
config: x86_64-randconfig-122-20240529 
(https://download.01.org/0day-ci/archive/20240529/202405291221.a0nstxhe-...@intel.com/config)
compiler: gcc-9 (Ubuntu 9.5.0-4ubuntu2) 9.5.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240529/202405291221.a0nstxhe-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202405291221.a0nstxhe-...@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_ucs2_utils.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/unicode/utf8-selftest.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/smb/common/cifs_arc4.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/smb/common/cifs_md4.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
security/keys/trusted-keys/trusted.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
security/keys/encrypted-keys/encrypted-keys.o
WARNING: modpost: missing MODULE_DESCRIPTION() in crypto/curve25519-generic.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit-example-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/math/prime_numbers.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/math/rational-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/crypto/libchacha.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_hexdump.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/find_bit_benchmark.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_firmware.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_hash.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_ida.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test-kstrtox.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_module.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_sort.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_user_copy.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_static_keys.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_static_key_base.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_printf.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_scanf.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_bitmap.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_uuid.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_memcat_p.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_free_pages.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_kprobes.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/atomic64_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/asn1_decoder.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/asn1_encoder.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_linear_ranges.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/siphash_kunit.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/clk/clk_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/regulator/max20411-regulator.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/lp.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_kunit_helpers.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_buddy_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_cmdline_parser_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_connector_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_damage_helper_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_dp_mst_helper_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_exec_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_format_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_framebuffer_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_gem_shmem_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_managed_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_mm_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_modes_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_plane_helper_test.o
WARNING: modpost: missing 

[drm-misc:drm-misc-next 16/29] ERROR: modpost: "drm_hdmi_compute_mode_clock" [drivers/gpu/drm/tests/drm_hdmi_state_helper_test.ko] undefined!

2024-05-28 Thread kernel test robot
tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head:   336dca397dcefc5d7436be1fee3c814ed6512996
commit: 945f516ed3468bef72f0da7c84a64a95c0ad28eb [16/29] drm/tests: Add HDMI 
connector bpc and format tests
config: i386-randconfig-002-20240529 
(https://download.01.org/0day-ci/archive/20240529/202405291109.pqdqc46g-...@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240529/202405291109.pqdqc46g-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202405291109.pqdqc46g-...@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

WARNING: modpost: missing MODULE_DESCRIPTION() in vmlinux.o
WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/locking/locktorture.o
WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/locking/test-ww_mutex.o
WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/rcu/rcutorture.o
WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/rcu/rcuscale.o
WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/rcu/refscale.o
WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/time/time_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/torture.o
WARNING: modpost: missing MODULE_DESCRIPTION() in mm/dmapool_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/ext4/ext4-inode-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/fat/fat_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
fs/bcachefs/mean_and_variance_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
security/apparmor/apparmor_policy_unpack_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit-example-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/clk/clk_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/clk/clk-gate_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/clk/clk-fractional-divider_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_kunit_helpers.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_buddy_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_cmdline_parser_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_connector_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_damage_helper_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_dp_mst_helper_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_exec_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_format_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_framebuffer_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_gem_shmem_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_managed_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_mm_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_modes_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_plane_helper_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_probe_helper_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/gpu/drm/tests/drm_rect_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/firewire/uapi-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/firewire/packet-serdes-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in 
drivers/input/tests/input_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/rtc/lib_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/of/of_test.o
ERROR: modpost: "drm_hdmi_compute_mode_clock" 
[drivers/gpu/drm/tests/drm_connector_test.ko] undefined!
>> ERROR: modpost: "drm_hdmi_compute_mode_clock" 
>> [drivers/gpu/drm/tests/drm_hdmi_state_helper_test.ko] undefined!

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for DRM_DISPLAY_HDMI_STATE_HELPER
   Depends on [n]: HAS_IOMEM [=y] && DRM [=y] && DRM_DISPLAY_HELPER [=y] && 
DRM_DISPLAY_HDMI_HELPER [=n]
   Selected by [m]:
   - DRM_KUNIT_TEST [=m] && HAS_IOMEM [=y] && DRM [=y] && KUNIT [=y] && MMU [=y]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Re: [PATCH net-next v9 11/14] tcp: RX path for devmem TCP

2024-05-28 Thread Pavel Begunkov

On 5/28/24 18:36, Mina Almasry wrote:

On Wed, May 22, 2024 at 11:02 PM David Wei  wrote:

...

+  */
+ if (!skb_frag_net_iov(frag)) {
+ net_err_ratelimited("Found non-dmabuf skb with 
net_iov");
+ err = -ENODEV;
+ goto out;
+ }
+
+ niov = skb_frag_net_iov(frag);


Sorry if we've already discussed this.

We have this additional hunk:

+ if (niov->pp->mp_ops != _devmem_ops) {
+   err = -ENODEV;
+   goto out;
+ }

In case one of our skbs end up here, skb_frag_is_net_iov() and
!skb_frags_readable(). Does this even matter? And if so then is there a
better way to distinguish between our two types of net_iovs?


Thanks for bringing this up, yes, maybe we do need a way to
distinguish, but it's not 100% critical, no? It's mostly for debug
checking?


Not really. io_uring definitely wouldn't want the devmem completion path
taking an iov and basically stashing it into a socket (via refcount),
that's a lifetime problem. Nor we'd have all the binding/chunk_owner
parts you have and probably use there.

Same the other way around, you don't want io_uring grabbing your iov
and locking it up, it won't even be possible to return it back. We
also may want to have access to backing pages for different fallback
purposes, for which we need to know the iov came from this particular
ring.

It shouldn't happen for a behaving user, but most of it would likely
be exploitable one way or another.


I would say add a helper, like net_iov_is_dmabuf() or net_iov_is_io_uring().


We're verifying that the context the iov bound to is the current
context (e.g. io_uring instance) we're executing from. If we can
agree that mp_priv should be a valid pointer, the check would look
like:

if (pp->mp_priv == io_uring_ifq)


Checking for niov->pp->mp_ops seems a bit hacky to me, and may be
outright broken. IIRC niov's can be disconnected from the page_pool
via page_pool_clear_pp_info(), and niov->pp may be null. Abstractly


It's called in the release path like page_pool_return_page(),
I can't imagine someone can sanely clear it while inflight ...


speaking the niov type maybe should be a property of the niov itself,
and not the pp the niov is attached to.


... but I can just stash all that in niov->owner,
struct dmabuf_genpool_chunk_owner you have. That might be even
cleaner. And regardless of it I'll be making some minor changes
to the structure to make it generic.


It is not immediately obvious to me what the best thing to do here is,
maybe it's best to add a flag to niov or to use niov->pp_magic for
this.

I would humbly ask that your follow up patchset takes care of this
bit, if possible. I think mine is doing quite a bit of heavy lifting
as is (and I think may be close to ready?), when it comes to concerns
of devmem + io_uring coexisting if you're able to take care, awesome,
if not, I can look into squashing some fix.


Let it be this way then. It's not a problem while there is
only one such a provider.

--
Pavel Begunkov


[PATCH v3 6/6] drm/ci: update xfails for the new testlist

2024-05-28 Thread Vignesh Raman
Now the testlist is used from IGT build, so update
xfails with the new testlist.

Set the timeout of all i915 jobs to 1h30m since some jobs
takes more than 1 hour to complete.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Vignesh Raman 
---

v2:
  - Set the timeout of all i915 jobs to 1h30m and updated expectations file.

v3:
  - Add a link to the email reporting the flaky tests to the maintainers.

---
 drivers/gpu/drm/ci/test.yml   |   6 +-
 .../gpu/drm/ci/xfails/amdgpu-stoney-fails.txt |  41 ++--
 .../drm/ci/xfails/amdgpu-stoney-flakes.txt|   7 +
 .../gpu/drm/ci/xfails/amdgpu-stoney-skips.txt |  18 ++
 drivers/gpu/drm/ci/xfails/i915-amly-fails.txt |  31 
 .../gpu/drm/ci/xfails/i915-amly-flakes.txt|   9 +
 drivers/gpu/drm/ci/xfails/i915-amly-skips.txt |  11 ++
 drivers/gpu/drm/ci/xfails/i915-apl-fails.txt  |  46 +++--
 drivers/gpu/drm/ci/xfails/i915-apl-flakes.txt |   6 +
 drivers/gpu/drm/ci/xfails/i915-apl-skips.txt  |  15 ++
 drivers/gpu/drm/ci/xfails/i915-cml-fails.txt  |  38 
 drivers/gpu/drm/ci/xfails/i915-cml-flakes.txt |   6 +
 drivers/gpu/drm/ci/xfails/i915-cml-skips.txt  |  14 ++
 drivers/gpu/drm/ci/xfails/i915-glk-fails.txt  |  41 +++-
 drivers/gpu/drm/ci/xfails/i915-glk-flakes.txt |   7 +
 drivers/gpu/drm/ci/xfails/i915-glk-skips.txt  |  15 ++
 drivers/gpu/drm/ci/xfails/i915-kbl-fails.txt  |  42 ++---
 drivers/gpu/drm/ci/xfails/i915-kbl-flakes.txt |   7 +-
 drivers/gpu/drm/ci/xfails/i915-kbl-skips.txt  |  25 +++
 drivers/gpu/drm/ci/xfails/i915-tgl-fails.txt  |  77 
 drivers/gpu/drm/ci/xfails/i915-tgl-skips.txt  |  17 ++
 drivers/gpu/drm/ci/xfails/i915-whl-fails.txt  |  63 ---
 drivers/gpu/drm/ci/xfails/i915-whl-flakes.txt |   6 +
 drivers/gpu/drm/ci/xfails/i915-whl-skips.txt  |  11 ++
 .../drm/ci/xfails/mediatek-mt8173-fails.txt   |  30 ++-
 .../drm/ci/xfails/mediatek-mt8173-flakes.txt  |  11 ++
 .../drm/ci/xfails/mediatek-mt8173-skips.txt   |   4 +
 .../drm/ci/xfails/mediatek-mt8183-fails.txt   |  21 +--
 .../drm/ci/xfails/mediatek-mt8183-skips.txt   |   4 +
 .../gpu/drm/ci/xfails/meson-g12b-fails.txt|  24 +--
 .../gpu/drm/ci/xfails/meson-g12b-skips.txt|   4 +
 .../gpu/drm/ci/xfails/msm-apq8016-fails.txt   |  12 +-
 .../gpu/drm/ci/xfails/msm-apq8016-skips.txt   |   4 +
 .../gpu/drm/ci/xfails/msm-apq8096-fails.txt   |   7 +
 .../gpu/drm/ci/xfails/msm-apq8096-flakes.txt  |   6 +
 .../gpu/drm/ci/xfails/msm-apq8096-skips.txt   |  12 ++
 .../msm-sc7180-trogdor-kingoftown-fails.txt   | 175 +-
 .../msm-sc7180-trogdor-kingoftown-flakes.txt  |   8 +
 .../msm-sc7180-trogdor-kingoftown-skips.txt   |   7 +
 ...sm-sc7180-trogdor-lazor-limozeen-fails.txt | 175 +-
 ...m-sc7180-trogdor-lazor-limozeen-flakes.txt |   6 +
 ...sm-sc7180-trogdor-lazor-limozeen-skips.txt |   4 +
 .../gpu/drm/ci/xfails/msm-sdm845-fails.txt|  38 +---
 .../gpu/drm/ci/xfails/msm-sdm845-flakes.txt   |  25 ++-
 .../gpu/drm/ci/xfails/msm-sdm845-skips.txt|   7 +
 .../drm/ci/xfails/rockchip-rk3288-fails.txt   |  62 +--
 .../drm/ci/xfails/rockchip-rk3288-skips.txt   |   4 +
 .../drm/ci/xfails/rockchip-rk3399-fails.txt   |  83 +
 .../drm/ci/xfails/rockchip-rk3399-flakes.txt  |  13 +-
 .../drm/ci/xfails/rockchip-rk3399-skips.txt   |   4 +
 drivers/gpu/drm/ci/xfails/update-xfails.py|   4 +-
 .../drm/ci/xfails/virtio_gpu-none-fails.txt   |  94 +++---
 .../drm/ci/xfails/virtio_gpu-none-skips.txt   |   4 +
 53 files changed, 1023 insertions(+), 388 deletions(-)
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-amly-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-apl-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-cml-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-glk-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-whl-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/mediatek-mt8173-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/msm-apq8096-flakes.txt
 create mode 100644 
drivers/gpu/drm/ci/xfails/msm-sc7180-trogdor-kingoftown-flakes.txt
 create mode 100644 
drivers/gpu/drm/ci/xfails/msm-sc7180-trogdor-lazor-limozeen-flakes.txt

diff --git a/drivers/gpu/drm/ci/test.yml b/drivers/gpu/drm/ci/test.yml
index 2615f67f6aa3..322cce714657 100644
--- a/drivers/gpu/drm/ci/test.yml
+++ b/drivers/gpu/drm/ci/test.yml
@@ -191,6 +191,7 @@ rockchip:rk3399:
   extends:
 - .lava-igt:x86_64
   stage: i915
+  timeout: "1h30m"
   variables:
 DRIVER_NAME: i915
 DTB: ""
@@ -201,7 +202,6 @@ i915:apl:
   extends:
 - .i915
   parallel: 3
-  timeout: "1h30m"
   variables:
 DEVICE_TYPE: asus-C523NA-A20057-coral
 GPU_VERSION: apl
@@ -211,7 +211,6 @@ i915:glk:
   extends:
 - .i915
   parallel: 2
-  timeout: "1h30m"
   variables:
 DEVICE_TYPE: hp-x360-12b-ca0010nr-n4020-octopus
 GPU_VERSION: glk
@@ -221,7 +220,6 @@ i915:amly:
   extends:
 - .i915
   parallel: 2
-  timeout: "1h30m"
   variables:
 DEVICE_TYPE: asus-C433TA-AJ0005-rammus
 

[PATCH v3 5/6] drm/ci: skip driver specific tests

2024-05-28 Thread Vignesh Raman
Skip driver specific tests and skip kms tests for
panfrost driver since it is not a kms driver.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Vignesh Raman 
---

v2:
  - Skip xe tests for amdgpu and virtio.

v3:
  - No changes.

---
 .../gpu/drm/ci/xfails/amdgpu-stoney-skips.txt   | 15 ++-
 drivers/gpu/drm/ci/xfails/i915-amly-skips.txt   | 11 ++-
 drivers/gpu/drm/ci/xfails/i915-apl-skips.txt| 11 ++-
 drivers/gpu/drm/ci/xfails/i915-cml-skips.txt|  9 +
 drivers/gpu/drm/ci/xfails/i915-glk-skips.txt| 11 ++-
 drivers/gpu/drm/ci/xfails/i915-kbl-skips.txt| 11 ++-
 drivers/gpu/drm/ci/xfails/i915-tgl-skips.txt| 11 ++-
 drivers/gpu/drm/ci/xfails/i915-whl-skips.txt| 11 ++-
 .../gpu/drm/ci/xfails/mediatek-mt8173-skips.txt | 12 
 .../gpu/drm/ci/xfails/mediatek-mt8183-skips.txt | 14 ++
 drivers/gpu/drm/ci/xfails/meson-g12b-skips.txt  | 14 ++
 drivers/gpu/drm/ci/xfails/msm-apq8016-skips.txt | 11 +++
 drivers/gpu/drm/ci/xfails/msm-apq8096-skips.txt | 14 +-
 .../msm-sc7180-trogdor-kingoftown-skips.txt | 12 
 .../msm-sc7180-trogdor-lazor-limozeen-skips.txt | 12 
 drivers/gpu/drm/ci/xfails/msm-sdm845-skips.txt  | 12 
 .../gpu/drm/ci/xfails/rockchip-rk3288-skips.txt | 17 -
 .../gpu/drm/ci/xfails/rockchip-rk3399-skips.txt | 15 +++
 .../gpu/drm/ci/xfails/virtio_gpu-none-skips.txt | 16 +++-
 19 files changed, 229 insertions(+), 10 deletions(-)
 create mode 100644 drivers/gpu/drm/ci/xfails/mediatek-mt8173-skips.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/mediatek-mt8183-skips.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/meson-g12b-skips.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/msm-apq8016-skips.txt

diff --git a/drivers/gpu/drm/ci/xfails/amdgpu-stoney-skips.txt 
b/drivers/gpu/drm/ci/xfails/amdgpu-stoney-skips.txt
index e2c538a0f954..21d26d5e67c2 100644
--- a/drivers/gpu/drm/ci/xfails/amdgpu-stoney-skips.txt
+++ b/drivers/gpu/drm/ci/xfails/amdgpu-stoney-skips.txt
@@ -1,2 +1,15 @@
 # Suspend to RAM seems to be broken on this machine
-.*suspend.*
\ No newline at end of file
+.*suspend.*
+
+# Skip driver specific tests
+msm_.*
+nouveau_.*
+panfrost_.*
+^v3d.*
+^vc4.*
+^vmwgfx*
+
+# Skip intel specific tests
+gem_.*
+i915_.*
+xe_.*
diff --git a/drivers/gpu/drm/ci/xfails/i915-amly-skips.txt 
b/drivers/gpu/drm/ci/xfails/i915-amly-skips.txt
index fe55540a3f9a..1e80987cf584 100644
--- a/drivers/gpu/drm/ci/xfails/i915-amly-skips.txt
+++ b/drivers/gpu/drm/ci/xfails/i915-amly-skips.txt
@@ -1,4 +1,13 @@
 # Suspend to RAM seems to be broken on this machine
 .*suspend.*
 # This is generating kernel oops with divide error
-kms_plane_scaling@invalid-parameters
\ No newline at end of file
+kms_plane_scaling@invalid-parameters
+
+# Skip driver specific tests
+^amdgpu.*
+msm_.*
+nouveau_.*
+panfrost_.*
+^v3d.*
+^vc4.*
+^vmwgfx*
diff --git a/drivers/gpu/drm/ci/xfails/i915-apl-skips.txt 
b/drivers/gpu/drm/ci/xfails/i915-apl-skips.txt
index 3430b215c06e..0104f2ffa8ba 100644
--- a/drivers/gpu/drm/ci/xfails/i915-apl-skips.txt
+++ b/drivers/gpu/drm/ci/xfails/i915-apl-skips.txt
@@ -3,4 +3,13 @@
 # This is generating kernel oops with divide error
 kms_plane_scaling@invalid-parameters
 # This is cascading issues
-kms_3d
\ No newline at end of file
+kms_3d
+
+# Skip driver specific tests
+^amdgpu.*
+msm_.*
+nouveau_.*
+panfrost_.*
+^v3d.*
+^vc4.*
+^vmwgfx*
diff --git a/drivers/gpu/drm/ci/xfails/i915-cml-skips.txt 
b/drivers/gpu/drm/ci/xfails/i915-cml-skips.txt
index 6d3d7ddc377f..398ebe163ad0 100644
--- a/drivers/gpu/drm/ci/xfails/i915-cml-skips.txt
+++ b/drivers/gpu/drm/ci/xfails/i915-cml-skips.txt
@@ -1,2 +1,11 @@
 # This is generating kernel oops with divide error
 kms_plane_scaling@invalid-parameters
+
+# Skip driver specific tests
+^amdgpu.*
+msm_.*
+nouveau_.*
+panfrost_.*
+^v3d.*
+^vc4.*
+^vmwgfx*
diff --git a/drivers/gpu/drm/ci/xfails/i915-glk-skips.txt 
b/drivers/gpu/drm/ci/xfails/i915-glk-skips.txt
index 4c7d00ce14bc..4f5419d62170 100644
--- a/drivers/gpu/drm/ci/xfails/i915-glk-skips.txt
+++ b/drivers/gpu/drm/ci/xfails/i915-glk-skips.txt
@@ -2,4 +2,13 @@
 .*suspend.*
 
 # This is generating kernel oops with divide error
-kms_plane_scaling@invalid-parameters
\ No newline at end of file
+kms_plane_scaling@invalid-parameters
+
+# Skip driver specific tests
+^amdgpu.*
+msm_.*
+nouveau_.*
+panfrost_.*
+^v3d.*
+^vc4.*
+^vmwgfx*
diff --git a/drivers/gpu/drm/ci/xfails/i915-kbl-skips.txt 
b/drivers/gpu/drm/ci/xfails/i915-kbl-skips.txt
index 4c7d00ce14bc..4f5419d62170 100644
--- a/drivers/gpu/drm/ci/xfails/i915-kbl-skips.txt
+++ b/drivers/gpu/drm/ci/xfails/i915-kbl-skips.txt
@@ -2,4 +2,13 @@
 .*suspend.*
 
 # This is generating kernel oops with divide error
-kms_plane_scaling@invalid-parameters
\ No newline at end of file
+kms_plane_scaling@invalid-parameters
+
+# Skip driver specific tests
+^amdgpu.*
+msm_.*

[PATCH v3 4/6] drm/ci: uprev IGT

2024-05-28 Thread Vignesh Raman
test-list.txt and test-list-full.txt are not generated for
cross-builds and they are required by drm-ci for testing
arm32 targets. This is fixed in igt-gpu-tools. So uprev
IGT to include the commit which fixes this issue. Also
disable building xe driver tests for non-intel platforms.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Vignesh Raman 
---

v2:
  - Split IGT uprev to seperate patch.

v3:
  - No changes.

---
 drivers/gpu/drm/ci/build-igt.sh  | 4 
 drivers/gpu/drm/ci/gitlab-ci.yml | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ci/build-igt.sh b/drivers/gpu/drm/ci/build-igt.sh
index b7d2a49a6db3..eddb5f782a5e 100644
--- a/drivers/gpu/drm/ci/build-igt.sh
+++ b/drivers/gpu/drm/ci/build-igt.sh
@@ -45,6 +45,10 @@ MESON_OPTIONS="-Doverlay=disabled\
-Dlibunwind=enabled   \
-Dprefix=/igt"
 
+if [[ "$KERNEL_ARCH" = "arm64" ]] || [[ "$KERNEL_ARCH" = "arm" ]]; then
+MESON_OPTIONS="$MESON_OPTIONS -Dxe_driver=disabled"
+fi
+
 mkdir -p /igt
 meson build $MESON_OPTIONS $EXTRA_MESON_ARGS
 ninja -C build -j${FDO_CI_CONCURRENT:-4} || ninja -C build -j 1
diff --git a/drivers/gpu/drm/ci/gitlab-ci.yml b/drivers/gpu/drm/ci/gitlab-ci.yml
index 8f32de63d92e..1b29c3b6406b 100644
--- a/drivers/gpu/drm/ci/gitlab-ci.yml
+++ b/drivers/gpu/drm/ci/gitlab-ci.yml
@@ -5,7 +5,7 @@ variables:
   UPSTREAM_REPO: git://anongit.freedesktop.org/drm/drm
   TARGET_BRANCH: drm-next
 
-  IGT_VERSION: d2af13d9f5be5ce23d996e4afd3e45990f5ab977
+  IGT_VERSION: 0df7b9b97f9da0e364f5ee30fe331004b8c86b56
 
   DEQP_RUNNER_GIT_URL: https://gitlab.freedesktop.org/anholt/deqp-runner.git
   DEQP_RUNNER_GIT_TAG: v0.15.0
-- 
2.40.1



[PATCH v3 3/6] drm/ci: generate testlist from build

2024-05-28 Thread Vignesh Raman
Stop vendoring the testlist into the kernel. Instead, use the
testlist from the IGT build to ensure we do not miss renamed
or newly added tests.

Signed-off-by: Vignesh Raman 
---

v2:
  - Fix testlist generation for arm and arm64 builds.

v3:
  - Rename generated testlist file to ci-testlist.

---
 drivers/gpu/drm/ci/build-igt.sh  |   35 +
 drivers/gpu/drm/ci/igt_runner.sh |9 +-
 drivers/gpu/drm/ci/testlist.txt  | 2761 --
 3 files changed, 40 insertions(+), 2765 deletions(-)
 delete mode 100644 drivers/gpu/drm/ci/testlist.txt

diff --git a/drivers/gpu/drm/ci/build-igt.sh b/drivers/gpu/drm/ci/build-igt.sh
index 7859554756c4..b7d2a49a6db3 100644
--- a/drivers/gpu/drm/ci/build-igt.sh
+++ b/drivers/gpu/drm/ci/build-igt.sh
@@ -3,6 +3,30 @@
 
 set -ex
 
+function generate_testlist {
+set +x
+while read -r line; do
+if [ "$line" = "TESTLIST" ] || [ "$line" = "END TESTLIST" ]; then
+continue
+fi
+
+tests=$(echo "$line" | tr ' ' '\n')
+
+for test in $tests; do
+output=$(/igt/libexec/igt-gpu-tools/"$test" --list-subtests || 
true)
+
+if [ -z "$output" ]; then
+echo "$test"
+else
+echo "$output" | while read -r subtest; do
+echo "$test@$subtest"
+done
+fi
+done
+done < /igt/libexec/igt-gpu-tools/test-list.txt > 
/igt/libexec/igt-gpu-tools/ci-testlist.txt
+set -x
+}
+
 git clone https://gitlab.freedesktop.org/drm/igt-gpu-tools.git --single-branch 
--no-checkout
 cd igt-gpu-tools
 git checkout $IGT_VERSION
@@ -26,6 +50,17 @@ meson build $MESON_OPTIONS $EXTRA_MESON_ARGS
 ninja -C build -j${FDO_CI_CONCURRENT:-4} || ninja -C build -j 1
 ninja -C build install
 
+if [[ "$KERNEL_ARCH" = "arm64" ]]; then
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/igt/lib/aarch64-linux-gnu
+elif [[ "$KERNEL_ARCH" = "arm" ]]; then
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/igt/lib
+else
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/igt/lib64
+fi
+
+echo "Generating ci-testlist.txt"
+generate_testlist
+
 mkdir -p artifacts/
 tar -cf artifacts/igt.tar /igt
 
diff --git a/drivers/gpu/drm/ci/igt_runner.sh b/drivers/gpu/drm/ci/igt_runner.sh
index f1a08b9b146f..d49ad434b580 100755
--- a/drivers/gpu/drm/ci/igt_runner.sh
+++ b/drivers/gpu/drm/ci/igt_runner.sh
@@ -59,25 +59,26 @@ fi
 
 curl -L --retry 4 -f --retry-all-errors --retry-delay 60 -s 
${FDO_HTTP_CACHE_URI:-}$PIPELINE_ARTIFACTS_BASE/$ARCH/igt.tar.gz | tar --zstd 
-v -x -C /
 
+TESTLIST="/igt/libexec/igt-gpu-tools/ci-testlist.txt"
 
 # If the job is parallel at the gitab job level, take the corresponding 
fraction
 # of the caselist.
 if [ -n "$CI_NODE_INDEX" ]; then
-sed -ni $CI_NODE_INDEX~$CI_NODE_TOTAL"p" /install/testlist.txt
+sed -ni $CI_NODE_INDEX~$CI_NODE_TOTAL"p" $TESTLIST
 fi
 
 # core_getversion checks if the driver is loaded and probed correctly
 # so run it in all shards
-if ! grep -q "core_getversion" /install/testlist.txt; then
+if ! grep -q "core_getversion" $TESTLIST; then
 # Add the line to the file
-echo "core_getversion" >> /install/testlist.txt
+echo "core_getversion" >> $TESTLIST
 fi
 
 set +e
 igt-runner \
 run \
 --igt-folder /igt/libexec/igt-gpu-tools \
---caselist /install/testlist.txt \
+--caselist $TESTLIST \
 --output /results \
 $IGT_SKIPS \
 $IGT_FLAKES \
diff --git a/drivers/gpu/drm/ci/testlist.txt b/drivers/gpu/drm/ci/testlist.txt
deleted file mode 100644
index 3377f002f8c5..
--- a/drivers/gpu/drm/ci/testlist.txt
+++ /dev/null
@@ -1,2761 +0,0 @@
-core_auth@getclient-simple
-core_auth@getclient-master-drop
-core_auth@basic-auth
-core_auth@many-magics
-core_getclient
-core_getstats
-core_getversion
-core_setmaster_vs_auth
-drm_read@invalid-buffer
-drm_read@fault-buffer
-drm_read@empty-block
-drm_read@empty-nonblock
-drm_read@short-buffer-block
-drm_read@short-buffer-nonblock
-drm_read@short-buffer-wakeup
-gem_eio@throttle
-gem_eio@create
-gem_eio@create-ext
-gem_eio@context-create
-gem_eio@execbuf
-gem_eio@banned
-gem_eio@suspend
-gem_eio@hibernate
-gem_eio@in-flight-external
-gem_eio@in-flight-suspend
-gem_eio@reset-stress
-gem_eio@unwedge-stress
-gem_eio@wait-immediate
-gem_eio@wait-wedge-immediate
-gem_eio@in-flight-immediate
-gem_eio@in-flight-contexts-immediate
-gem_eio@in-flight-internal-immediate
-gem_eio@wait-1us
-gem_eio@wait-wedge-1us
-gem_eio@in-flight-1us
-gem_eio@in-flight-contexts-1us
-gem_eio@in-flight-internal-1us
-gem_eio@wait-10ms
-gem_eio@wait-wedge-10ms
-gem_eio@in-flight-10ms
-gem_eio@in-flight-contexts-10ms
-gem_eio@in-flight-internal-10ms
-gem_eio@kms
-kms_3d
-kms_addfb_basic@unused-handle
-kms_addfb_basic@unused-pitches
-kms_addfb_basic@unused-offsets
-kms_addfb_basic@unused-modifier
-kms_addfb_basic@clobberred-modifier
-kms_addfb_basic@invalid-smem-bo-on-discrete
-kms_addfb_basic@legacy-format
-kms_addfb_basic@no-handle
-kms_addfb_basic@basic

[PATCH v3 1/6] drm/ci: uprev mesa version

2024-05-28 Thread Vignesh Raman
zlib.net is not allowing tarball download anymore and results
in below error in kernel+rootfs_arm32 container build,
urllib.error.HTTPError: HTTP Error 403: Forbidden
urllib.error.HTTPError: HTTP Error 415: Unsupported Media Type

Uprev mesa to latest version which includes a fix for this issue.
https://gitlab.freedesktop.org/mesa/mesa/-/commit/908f444e

Use id_tokens for JWT authentication. Since s3 bucket is migrated to
mesa-rootfs, update the variables accordingly. Also copy helper scripts
to install, so that the ci jobs can use these scripts for logging.

Signed-off-by: Vignesh Raman 
---

v2:
  - Uprev to recent version and use id_tokens for JWT authentication

v3:
  - Move adding farm variable and updating device type variable to seperate 
commit

---
 drivers/gpu/drm/ci/build-igt.sh   |  2 +-
 drivers/gpu/drm/ci/build.sh   |  6 +++--
 drivers/gpu/drm/ci/container.yml  | 12 +++--
 drivers/gpu/drm/ci/gitlab-ci.yml  | 44 +--
 drivers/gpu/drm/ci/image-tags.yml |  2 +-
 drivers/gpu/drm/ci/lava-submit.sh |  4 +--
 6 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/ci/build-igt.sh b/drivers/gpu/drm/ci/build-igt.sh
index 500fa4f5c30a..7859554756c4 100644
--- a/drivers/gpu/drm/ci/build-igt.sh
+++ b/drivers/gpu/drm/ci/build-igt.sh
@@ -32,4 +32,4 @@ tar -cf artifacts/igt.tar /igt
 # Pass needed files to the test stage
 S3_ARTIFACT_NAME="igt.tar.gz"
 gzip -c artifacts/igt.tar > ${S3_ARTIFACT_NAME}
-ci-fairy s3cp --token-file "${CI_JOB_JWT_FILE}" ${S3_ARTIFACT_NAME} 
https://${PIPELINE_ARTIFACTS_BASE}/${KERNEL_ARCH}/${S3_ARTIFACT_NAME}
+ci-fairy s3cp --token-file "${S3_JWT_FILE}" ${S3_ARTIFACT_NAME} 
https://${PIPELINE_ARTIFACTS_BASE}/${KERNEL_ARCH}/${S3_ARTIFACT_NAME}
diff --git a/drivers/gpu/drm/ci/build.sh b/drivers/gpu/drm/ci/build.sh
index 106f2d40d222..a67871fdcd3f 100644
--- a/drivers/gpu/drm/ci/build.sh
+++ b/drivers/gpu/drm/ci/build.sh
@@ -128,6 +128,7 @@ fi
 # Pass needed files to the test stage
 mkdir -p install
 cp -rfv .gitlab-ci/* install/.
+cp -rfv ci/*  install/.
 cp -rfv install/common install/ci-common
 cp -rfv drivers/gpu/drm/ci/* install/.
 
@@ -141,14 +142,15 @@ if [[ "$UPLOAD_TO_MINIO" = "1" ]]; then
 FILES_TO_UPLOAD="$FILES_TO_UPLOAD $(basename -a $DEVICE_TREES)"
 fi
 
+ls -l "${S3_JWT_FILE}"
 for f in $FILES_TO_UPLOAD; do
-ci-fairy s3cp --token-file "${CI_JOB_JWT_FILE}" /lava-files/$f \
+ci-fairy s3cp --token-file "${S3_JWT_FILE}" /lava-files/$f \
 https://${PIPELINE_ARTIFACTS_BASE}/${DEBIAN_ARCH}/$f
 done
 
 S3_ARTIFACT_NAME="kernel-files.tar.zst"
 tar --zstd -cf $S3_ARTIFACT_NAME install
-ci-fairy s3cp --token-file "${CI_JOB_JWT_FILE}" ${S3_ARTIFACT_NAME} 
https://${PIPELINE_ARTIFACTS_BASE}/${DEBIAN_ARCH}/${S3_ARTIFACT_NAME}
+ci-fairy s3cp --token-file "${S3_JWT_FILE}" ${S3_ARTIFACT_NAME} 
https://${PIPELINE_ARTIFACTS_BASE}/${DEBIAN_ARCH}/${S3_ARTIFACT_NAME}
 
 echo "Download vmlinux.xz from 
https://${PIPELINE_ARTIFACTS_BASE}/${DEBIAN_ARCH}/vmlinux.xz;
 fi
diff --git a/drivers/gpu/drm/ci/container.yml b/drivers/gpu/drm/ci/container.yml
index 9764e7921a4f..d6edf3635b23 100644
--- a/drivers/gpu/drm/ci/container.yml
+++ b/drivers/gpu/drm/ci/container.yml
@@ -36,15 +36,15 @@ debian/android_build:
   rules:
 - when: never
 
-debian/x86_64_test-android:
+.debian/x86_64_test-android:
   rules:
 - when: never
 
-windows_build_vs2019:
+windows_build_msvc:
   rules:
 - when: never
 
-windows_test_vs2019:
+windows_test_msvc:
   rules:
 - when: never
 
@@ -56,10 +56,6 @@ rustfmt:
rules:
 - when: never
 
-windows_vs2019:
-   rules:
-- when: never
-
-clang-format:
+windows_msvc:
rules:
 - when: never
\ No newline at end of file
diff --git a/drivers/gpu/drm/ci/gitlab-ci.yml b/drivers/gpu/drm/ci/gitlab-ci.yml
index 084e3ff8e3f4..8f32de63d92e 100644
--- a/drivers/gpu/drm/ci/gitlab-ci.yml
+++ b/drivers/gpu/drm/ci/gitlab-ci.yml
@@ -1,6 +1,6 @@
 variables:
   DRM_CI_PROJECT_PATH:  mesa/mesa
-  DRM_CI_COMMIT_SHA:  
9d162de9a05155e1c4041857a5848842749164cf
+  DRM_CI_COMMIT_SHA:  
e2b9c5a9e3e4f9b532067af8022eaef8d6fc6c00
 
   UPSTREAM_REPO: git://anongit.freedesktop.org/drm/drm
   TARGET_BRANCH: drm-next
@@ -19,33 +19,47 @@ variables:
   bash download-git-cache.sh
   rm download-git-cache.sh
   set +o xtrace
+  S3_JWT_FILE: /s3_jwt
   S3_HOST: s3.freedesktop.org
+  # This bucket is used to fetch the kernel image
+  S3_KERNEL_BUCKET: mesa-rootfs
+  # Bucket for git cache
+  S3_GITCACHE_BUCKET: git-cache
+  # Bucket for the pipeline artifacts pushed to S3
+  S3_ARTIFACTS_BUCKET: artifacts
   # per-pipeline artifact storage on MinIO
-  PIPELINE_ARTIFACTS_BASE: 
${S3_HOST}/artifacts/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}
+  PIPELINE_ARTIFACTS_BASE: 
${S3_HOST}/${S3_ARTIFACTS_BUCKET}/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}
   # per-job artifact storage on MinIO
   JOB_ARTIFACTS_BASE: 

[PATCH v3 2/6] drm/ci: add farm variable

2024-05-28 Thread Vignesh Raman
Mesa uses structured logs for logging and debug purpose,
https://mesa.pages.freedesktop.org/-/mesa/-/jobs/59165650/artifacts/results/job_detail.json

Since drm-ci uses the mesa scripts, add the farm variable
and update the device type for missing jobs.

Signed-off-by: Vignesh Raman 
---

v3:
  - New commit to add farm variable and update device type variable.

---
 drivers/gpu/drm/ci/test.yml | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ci/test.yml b/drivers/gpu/drm/ci/test.yml
index 8bc63912fddb..2615f67f6aa3 100644
--- a/drivers/gpu/drm/ci/test.yml
+++ b/drivers/gpu/drm/ci/test.yml
@@ -24,6 +24,7 @@
   variables:
 HWCI_TEST_SCRIPT: "/install/igt_runner.sh"
 DEBIAN_ARCH: "armhf"
+FARM: collabora
   dependencies:
 - testing:arm32
   needs:
@@ -39,6 +40,7 @@
   variables:
 HWCI_TEST_SCRIPT: "/install/igt_runner.sh"
 DEBIAN_ARCH: "arm64"
+FARM: collabora
   dependencies:
 - testing:arm64
   needs:
@@ -54,6 +56,7 @@
   variables:
 HWCI_TEST_SCRIPT: "/install/igt_runner.sh"
 DEBIAN_ARCH: "amd64"
+FARM: collabora
   dependencies:
 - testing:x86_64
   needs:
@@ -74,6 +77,7 @@
 S3_ARTIFACT_NAME: "arm64/kernel-files"
 BM_KERNEL: https://${PIPELINE_ARTIFACTS_BASE}/arm64/Image.gz
 BM_CMDLINE: "ip=dhcp console=ttyMSM0,115200n8 $BM_KERNEL_EXTRA_ARGS 
root=/dev/nfs rw nfsrootdebug nfsroot=,tcp,nfsvers=4.2 init=/init 
$BM_KERNELARGS"
+FARM: google
   needs:
 - debian/arm64_test
 - job: testing:arm64
@@ -116,8 +120,9 @@ msm:apq8016:
 - .baremetal-igt-arm64
   stage: msm
   variables:
+DEVICE_TYPE: apq8016-sbc-usb-host
 DRIVER_NAME: msm
-BM_DTB: https://${PIPELINE_ARTIFACTS_BASE}/arm64/apq8016-sbc-usb-host.dtb
+BM_DTB: https://${PIPELINE_ARTIFACTS_BASE}/arm64/${DEVICE_TYPE}.dtb
 GPU_VERSION: apq8016
 # disabling unused clocks congests with the MDSS runtime PM trying to
 # disable those clocks and causes boot to fail.
@@ -132,9 +137,10 @@ msm:apq8096:
 - .baremetal-igt-arm64
   stage: msm
   variables:
+DEVICE_TYPE: apq8096-db820c
 DRIVER_NAME: msm
 BM_KERNEL_EXTRA_ARGS: maxcpus=2
-BM_DTB: https://${PIPELINE_ARTIFACTS_BASE}/arm64/apq8096-db820c.dtb
+BM_DTB: https://${PIPELINE_ARTIFACTS_BASE}/arm64/${DEVICE_TYPE}.dtb
 GPU_VERSION: apq8096
 RUNNER_TAG: google-freedreno-db820c
   script:
@@ -146,6 +152,7 @@ msm:sdm845:
   stage: msm
   parallel: 6
   variables:
+DEVICE_TYPE: sdm845-cheza-r3
 DRIVER_NAME: msm
 BM_KERNEL: https://${PIPELINE_ARTIFACTS_BASE}/arm64/cheza-kernel
 GPU_VERSION: sdm845
-- 
2.40.1



[PATCH v3 0/6] drm/ci: uprev mesa/IGT and generate testlist

2024-05-28 Thread Vignesh Raman
Uprev mesa and IGT to the latest version and stop vendoring the
testlist into the kernel. Instead, use the testlist from the
IGT build to ensure we do not miss renamed or newly added tests.
Update the xfails with the latest testlist run.

Add farm variable and update device type variable.

https://gitlab.freedesktop.org/vigneshraman/linux/-/pipelines/1187556

Vignesh Raman (6):
  drm/ci: uprev mesa version
  drm/ci: add farm variable
  drm/ci: generate testlist from build
  drm/ci: uprev IGT
  drm/ci: skip driver specific tests
  drm/ci: update xfails for the new testlist

 drivers/gpu/drm/ci/build-igt.sh   |   41 +-
 drivers/gpu/drm/ci/build.sh   |6 +-
 drivers/gpu/drm/ci/container.yml  |   12 +-
 drivers/gpu/drm/ci/gitlab-ci.yml  |   46 +-
 drivers/gpu/drm/ci/igt_runner.sh  |9 +-
 drivers/gpu/drm/ci/image-tags.yml |2 +-
 drivers/gpu/drm/ci/lava-submit.sh |4 +-
 drivers/gpu/drm/ci/test.yml   |   17 +-
 drivers/gpu/drm/ci/testlist.txt   | 2761 -
 .../gpu/drm/ci/xfails/amdgpu-stoney-fails.txt |   41 +-
 .../drm/ci/xfails/amdgpu-stoney-flakes.txt|7 +
 .../gpu/drm/ci/xfails/amdgpu-stoney-skips.txt |   33 +-
 drivers/gpu/drm/ci/xfails/i915-amly-fails.txt |   31 +
 .../gpu/drm/ci/xfails/i915-amly-flakes.txt|9 +
 drivers/gpu/drm/ci/xfails/i915-amly-skips.txt |   22 +-
 drivers/gpu/drm/ci/xfails/i915-apl-fails.txt  |   46 +-
 drivers/gpu/drm/ci/xfails/i915-apl-flakes.txt |6 +
 drivers/gpu/drm/ci/xfails/i915-apl-skips.txt  |   26 +-
 drivers/gpu/drm/ci/xfails/i915-cml-fails.txt  |   38 +
 drivers/gpu/drm/ci/xfails/i915-cml-flakes.txt |6 +
 drivers/gpu/drm/ci/xfails/i915-cml-skips.txt  |   23 +
 drivers/gpu/drm/ci/xfails/i915-glk-fails.txt  |   41 +-
 drivers/gpu/drm/ci/xfails/i915-glk-flakes.txt |7 +
 drivers/gpu/drm/ci/xfails/i915-glk-skips.txt  |   26 +-
 drivers/gpu/drm/ci/xfails/i915-kbl-fails.txt  |   42 +-
 drivers/gpu/drm/ci/xfails/i915-kbl-flakes.txt |7 +-
 drivers/gpu/drm/ci/xfails/i915-kbl-skips.txt  |   36 +-
 drivers/gpu/drm/ci/xfails/i915-tgl-fails.txt  |   77 +-
 drivers/gpu/drm/ci/xfails/i915-tgl-skips.txt  |   28 +-
 drivers/gpu/drm/ci/xfails/i915-whl-fails.txt  |   63 +-
 drivers/gpu/drm/ci/xfails/i915-whl-flakes.txt |6 +
 drivers/gpu/drm/ci/xfails/i915-whl-skips.txt  |   22 +-
 .../drm/ci/xfails/mediatek-mt8173-fails.txt   |   30 +-
 .../drm/ci/xfails/mediatek-mt8173-flakes.txt  |   11 +
 .../drm/ci/xfails/mediatek-mt8173-skips.txt   |   16 +
 .../drm/ci/xfails/mediatek-mt8183-fails.txt   |   21 +-
 .../drm/ci/xfails/mediatek-mt8183-skips.txt   |   18 +
 .../gpu/drm/ci/xfails/meson-g12b-fails.txt|   24 +-
 .../gpu/drm/ci/xfails/meson-g12b-skips.txt|   18 +
 .../gpu/drm/ci/xfails/msm-apq8016-fails.txt   |   12 +-
 .../gpu/drm/ci/xfails/msm-apq8016-skips.txt   |   15 +
 .../gpu/drm/ci/xfails/msm-apq8096-fails.txt   |7 +
 .../gpu/drm/ci/xfails/msm-apq8096-flakes.txt  |6 +
 .../gpu/drm/ci/xfails/msm-apq8096-skips.txt   |   26 +-
 .../msm-sc7180-trogdor-kingoftown-fails.txt   |  175 +-
 .../msm-sc7180-trogdor-kingoftown-flakes.txt  |8 +
 .../msm-sc7180-trogdor-kingoftown-skips.txt   |   19 +
 ...sm-sc7180-trogdor-lazor-limozeen-fails.txt |  175 +-
 ...m-sc7180-trogdor-lazor-limozeen-flakes.txt |6 +
 ...sm-sc7180-trogdor-lazor-limozeen-skips.txt |   16 +
 .../gpu/drm/ci/xfails/msm-sdm845-fails.txt|   38 +-
 .../gpu/drm/ci/xfails/msm-sdm845-flakes.txt   |   25 +-
 .../gpu/drm/ci/xfails/msm-sdm845-skips.txt|   19 +
 .../drm/ci/xfails/rockchip-rk3288-fails.txt   |   62 +-
 .../drm/ci/xfails/rockchip-rk3288-skips.txt   |   21 +-
 .../drm/ci/xfails/rockchip-rk3399-fails.txt   |   83 +-
 .../drm/ci/xfails/rockchip-rk3399-flakes.txt  |   13 +-
 .../drm/ci/xfails/rockchip-rk3399-skips.txt   |   19 +
 drivers/gpu/drm/ci/xfails/update-xfails.py|4 +-
 .../drm/ci/xfails/virtio_gpu-none-fails.txt   |   94 +-
 .../drm/ci/xfails/virtio_gpu-none-skips.txt   |   20 +-
 61 files changed, 1348 insertions(+), 3194 deletions(-)
 delete mode 100644 drivers/gpu/drm/ci/testlist.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-amly-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-apl-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-cml-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-glk-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/i915-whl-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/mediatek-mt8173-flakes.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/mediatek-mt8173-skips.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/mediatek-mt8183-skips.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/meson-g12b-skips.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/msm-apq8016-skips.txt
 create mode 100644 drivers/gpu/drm/ci/xfails/msm-apq8096-flakes.txt
 create mode 100644 
drivers/gpu/drm/ci/xfails/msm-sc7180-trogdor-kingoftown-flakes.txt

linux-next: build failure after merge of the drm-misc tree

2024-05-28 Thread Stephen Rothwell
Hi all,

After merging the drm-misc tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c: In function 
'sun4i_hdmi_connector_mode_valid':
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c:213:17: error: implicit declaration of 
function 'drm_connector_hdmi_compute_mode_clock'; did you mean 
'drm_hdmi_compute_mode_clock'? [-Werror=implicit-function-declaration]
  213 | drm_connector_hdmi_compute_mode_clock(mode, 8,
  | ^
  | drm_hdmi_compute_mode_clock
cc1: some warnings being treated as errors

Caused by commit

  ea64761a54a2 ("drm/sun4i: hdmi: Switch to HDMI connector")

I have used the drm-misc tree from next-20240528 for today.

-- 
Cheers,
Stephen Rothwell


pgpR8maU6RPJP.pgp
Description: OpenPGP digital signature


linux-next: build failure after merge of the drm-misc tree

2024-05-28 Thread Stephen Rothwell
Hi all,

After merging the drm-misc tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_bo.c:26:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~
In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_fence.c:4:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~
In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_gem.c:15:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~
In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_mmu.c:21:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~
In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_irq.c:19:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~
In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_sched.c:26:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~
In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_trace_points.c:4:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~
In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_sysfs.c:9:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~
In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_debugfs.c:12:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~
In file included from drivers/gpu/drm/v3d/v3d_drv.h:14,
 from drivers/gpu/drm/v3d/v3d_submit.c:9:
drivers/gpu/drm/v3d/v3d_performance_counters.h:118:43: warning: 
'v3d_v42_performance_counters' defined but not used [-Wunused-const-variable=]
  118 | static const struct v3d_perf_counter_desc 
v3d_v42_performance_counters[] = {
  |   ^~~~

Caused by commit

  3cbcbe016c31 ("drm/v3d: Add Performance Counters descriptions for V3D 4.2 and 
7.1")

I have used the drm-misc tree from next-20240528 for today.
-- 
Cheers,
Stephen Rothwell


pgpInwIXk_leF.pgp
Description: OpenPGP digital signature


Re: [PATCH RESEND,v6 8/8] soc: mediatek: mtk-cmdq: Add secure cmdq_pkt APIs

2024-05-28 Thread 胡俊光


Re: [PATCH] drm: renesas: rcar-du: Add drm_panic support for non-vsp

2024-05-28 Thread Laurent Pinchart
Hi Geert,

Thank you for the patch.

On Mon, May 27, 2024 at 03:35:49PM +0200, Geert Uytterhoeven wrote:
> Add support for the drm_panic module for DU variants not using the
> VSP-compositor, to display a message on the screen when a kernel panic
> occurs.
> 
> Signed-off-by: Geert Uytterhoeven 
> ---
> Tested on Koelsch (R-Car M2-W).
> 
> Support for DU variants using the VSP-compositor is more convoluted,
> and left to the DU experts.

That's not high on my priority list, so if anyone wants to play, be my
guest :-)

> ---
>  drivers/gpu/drm/renesas/rcar-du/rcar_du_plane.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_plane.c 
> b/drivers/gpu/drm/renesas/rcar-du/rcar_du_plane.c
> index e445fac8e0b46c21..c546ab0805d656f6 100644
> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_plane.c
> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_plane.c
> @@ -680,6 +680,12 @@ static const struct drm_plane_helper_funcs 
> rcar_du_plane_helper_funcs = {
>   .atomic_update = rcar_du_plane_atomic_update,
>  };
>  
> +static const struct drm_plane_helper_funcs 
> rcar_du_primary_plane_helper_funcs = {
> + .atomic_check = rcar_du_plane_atomic_check,
> + .atomic_update = rcar_du_plane_atomic_update,
> + .get_scanout_buffer = drm_fb_dma_get_scanout_buffer,
> +};
> +
>  static struct drm_plane_state *
>  rcar_du_plane_atomic_duplicate_state(struct drm_plane *plane)
>  {
> @@ -812,8 +818,12 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
>   if (ret < 0)
>   return ret;
>  
> - drm_plane_helper_add(>plane,
> -  _du_plane_helper_funcs);
> + if (type == DRM_PLANE_TYPE_PRIMARY)
> + drm_plane_helper_add(>plane,
> +  
> _du_primary_plane_helper_funcs);
> + else
> + drm_plane_helper_add(>plane,
> +  _du_plane_helper_funcs);

Same comment as for the shmobile-drm patch. Let's discuss it there.

>  
>   drm_plane_create_alpha_property(>plane);
>  

-- 
Regards,

Laurent Pinchart


Re: [PATCH] drm: renesas: shmobile: Add drm_panic support

2024-05-28 Thread Laurent Pinchart
Hi Geert,

Thank you for the patch.

On Mon, May 27, 2024 at 03:34:48PM +0200, Geert Uytterhoeven wrote:
> Add support for the drm_panic module, which displays a message on
> the screen when a kernel panic occurs.
> 
> Signed-off-by: Geert Uytterhoeven 
> ---
> Tested on Armadillo-800-EVA.
> ---
>  drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c 
> b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
> index 07ad17d24294d5e6..9d166ab2af8bd231 100644
> --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
> +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
> @@ -273,6 +273,13 @@ static const struct drm_plane_helper_funcs 
> shmob_drm_plane_helper_funcs = {
>   .atomic_disable = shmob_drm_plane_atomic_disable,
>  };
>  
> +static const struct drm_plane_helper_funcs 
> shmob_drm_primary_plane_helper_funcs = {
> + .atomic_check = shmob_drm_plane_atomic_check,
> + .atomic_update = shmob_drm_plane_atomic_update,
> + .atomic_disable = shmob_drm_plane_atomic_disable,
> + .get_scanout_buffer = drm_fb_dma_get_scanout_buffer,
> +};
> +
>  static const struct drm_plane_funcs shmob_drm_plane_funcs = {
>   .update_plane = drm_atomic_helper_update_plane,
>   .disable_plane = drm_atomic_helper_disable_plane,
> @@ -310,7 +317,12 @@ struct drm_plane *shmob_drm_plane_create(struct 
> shmob_drm_device *sdev,
>  
>   splane->index = index;
>  
> - drm_plane_helper_add(>base, _drm_plane_helper_funcs);
> + if (type == DRM_PLANE_TYPE_PRIMARY)
> + drm_plane_helper_add(>base,
> +  _drm_primary_plane_helper_funcs);
> + else
> + drm_plane_helper_add(>base,
> +  _drm_plane_helper_funcs);

It's not very nice to have to provide different operations for the
primary and overlay planes. The documentation of
drm_fb_dma_get_scanout_buffer() states

 * @plane: DRM primary plane

If the intent is that only primary planes will be used to display the
panic message, shouldn't drm_panic_register() skip overlay planes ? It
would simplify drivers.

>  
>   return >base;
>  }

-- 
Regards,

Laurent Pinchart


Re: [PATCH v2 resend 8/8] fbdev: omapfb: use of_graph_get_remote_port()

2024-05-28 Thread Laurent Pinchart
Hi Morimoto-san,

Thank you for the patch.

On Tue, May 28, 2024 at 11:55:59PM +, Kuninori Morimoto wrote:
> We already have of_graph_get_remote_port(), Let's use it.
> 
> Signed-off-by: Kuninori Morimoto 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 15 +--
>  1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c 
> b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
> index 14965a3fd05b7..4040e247e026e 100644
> --- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
> +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
> @@ -117,19 +117,6 @@ u32 dss_of_port_get_port_number(struct device_node *port)
>   return reg;
>  }
>  
> -static struct device_node *omapdss_of_get_remote_port(const struct 
> device_node *node)
> -{
> - struct device_node *np;
> -
> - np = of_graph_get_remote_endpoint(node);
> - if (!np)
> - return NULL;
> -
> - np = of_get_next_parent(np);
> -
> - return np;
> -}
> -
>  struct omap_dss_device *
>  omapdss_of_find_source_for_first_ep(struct device_node *node)
>  {
> @@ -141,7 +128,7 @@ omapdss_of_find_source_for_first_ep(struct device_node 
> *node)
>   if (!ep)
>   return ERR_PTR(-EINVAL);
>  
> - src_port = omapdss_of_get_remote_port(ep);
> + src_port = of_graph_get_remote_port(ep);
>   if (!src_port) {
>   of_node_put(ep);
>   return ERR_PTR(-EINVAL);

-- 
Regards,

Laurent Pinchart


Re: [PATCH v2 resend 7/8] video: fbdev: use for_each_endpoint_of_node()

2024-05-28 Thread Laurent Pinchart
Hi Morimoto-san,

Thank you for the patch.

On Tue, May 28, 2024 at 11:55:55PM +, Kuninori Morimoto wrote:
> We already have for_each_endpoint_of_node(), don't use
> of_graph_get_next_endpoint() directly. Replace it.
> 
> Signed-off-by: Kuninori Morimoto 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c 
> b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
> index 09f719af0d0c9..d80720c843235 100644
> --- a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
> +++ b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
> @@ -149,8 +149,7 @@ static void __init omapdss_walk_device(struct device_node 
> *node, bool root)
>  
>   of_node_put(n);
>  
> - n = NULL;
> - while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
> + for_each_endpoint_of_node(node, n) {
>   struct device_node *pn;
>  
>   pn = of_graph_get_remote_port_parent(n);

-- 
Regards,

Laurent Pinchart


Re: [PATCH v2 resend 6/8] staging: media: atmel: use for_each_endpoint_of_node()

2024-05-28 Thread Laurent Pinchart
Hi Morimoto-san,

Thank you for the patch.

On Tue, May 28, 2024 at 11:55:51PM +, Kuninori Morimoto wrote:
> We already have for_each_endpoint_of_node(), don't use
> of_graph_get_next_endpoint() directly. Replace it.
> 
> Signed-off-by: Kuninori Morimoto 
> ---
>  drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c | 6 +-
>  drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c | 6 +-
>  2 files changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c 
> b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
> index 31b2b48085c59..cbfbec0c6cb57 100644
> --- a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
> +++ b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
> @@ -340,13 +340,9 @@ static int isc_parse_dt(struct device *dev, struct 
> isc_device *isc)
>  
>   INIT_LIST_HEAD(>subdev_entities);
>  
> - while (1) {
> + for_each_endpoint_of_node(np, epn) {

I think epn doesn't have to be initialized to NULL anymore. Same below.

Reviewed-by: Laurent Pinchart 

>   struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
>  
> - epn = of_graph_get_next_endpoint(np, epn);
> - if (!epn)
> - return 0;
> -
>   ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
>_epn);
>   if (ret) {
> diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c 
> b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
> index 020034f631f57..7c477b1d3c484 100644
> --- a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
> +++ b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
> @@ -326,13 +326,9 @@ static int xisc_parse_dt(struct device *dev, struct 
> isc_device *isc)
>  
>   mipi_mode = of_property_read_bool(np, "microchip,mipi-mode");
>  
> - while (1) {
> + for_each_endpoint_of_node(np, epn) {
>   struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
>  
> - epn = of_graph_get_next_endpoint(np, epn);
> - if (!epn)
> - return 0;
> -
>   ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
>_epn);
>   if (ret) {

-- 
Regards,

Laurent Pinchart


Re: [PATCH v2 resend 5/8] media: platform: xilinx: use for_each_endpoint_of_node()

2024-05-28 Thread Laurent Pinchart
Hi Morimoto-san,

Thank you for the patch.

On Tue, May 28, 2024 at 11:55:46PM +, Kuninori Morimoto wrote:
> We already have for_each_endpoint_of_node(), don't use
> of_graph_get_next_endpoint() directly. Replace it.
> 
> Signed-off-by: Kuninori Morimoto 
> ---
>  drivers/media/platform/xilinx/xilinx-vipp.c | 7 +--
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c 
> b/drivers/media/platform/xilinx/xilinx-vipp.c
> index 996684a730383..38818b82a575e 100644
> --- a/drivers/media/platform/xilinx/xilinx-vipp.c
> +++ b/drivers/media/platform/xilinx/xilinx-vipp.c
> @@ -205,12 +205,7 @@ static int xvip_graph_build_dma(struct 
> xvip_composite_device *xdev)

I think ep doesn't have to be initialized to NULL anymore.

Reviewed-by: Laurent Pinchart 

>  
>   dev_dbg(xdev->dev, "creating links for DMA engines\n");
>  
> - while (1) {
> - /* Get the next endpoint and parse its link. */
> - ep = of_graph_get_next_endpoint(node, ep);
> - if (ep == NULL)
> - break;
> -
> + for_each_endpoint_of_node(node, ep) {
>   dev_dbg(xdev->dev, "processing endpoint %pOF\n", ep);
>  
>   ret = v4l2_fwnode_parse_link(of_fwnode_handle(ep), );

-- 
Regards,

Laurent Pinchart


Re: [PATCH v2 resend 4/8] media: platform: ti: use for_each_endpoint_of_node()

2024-05-28 Thread Laurent Pinchart
Hello Morimoto-san,

Thank you for the patch.

On Tue, May 28, 2024 at 11:55:42PM +, Kuninori Morimoto wrote:
> We already have for_each_endpoint_of_node(), don't use
> of_graph_get_next_endpoint() directly. Replace it.
> 
> Signed-off-by: Kuninori Morimoto 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/media/platform/ti/am437x/am437x-vpfe.c   | 12 +---
>  drivers/media/platform/ti/davinci/vpif_capture.c | 12 ++--
>  2 files changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c 
> b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> index 77e12457d1495..009ff68a2b43c 100644
> --- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> @@ -2287,7 +2287,7 @@ static const struct v4l2_async_notifier_operations 
> vpfe_async_ops = {
>  static struct vpfe_config *
>  vpfe_get_pdata(struct vpfe_device *vpfe)
>  {
> - struct device_node *endpoint = NULL;
> + struct device_node *endpoint;
>   struct device *dev = vpfe->pdev;
>   struct vpfe_subdev_info *sdinfo;
>   struct vpfe_config *pdata;
> @@ -2306,14 +2306,11 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
>   if (!pdata)
>   return NULL;
>  
> - for (i = 0; ; i++) {
> + i = 0;
> + for_each_endpoint_of_node(dev->of_node, endpoint) {
>   struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
>   struct device_node *rem;
>  
> - endpoint = of_graph_get_next_endpoint(dev->of_node, endpoint);
> - if (!endpoint)
> - break;
> -
>   sdinfo = >sub_devs[i];
>   sdinfo->grp_id = 0;
>  
> @@ -2371,9 +2368,10 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
>   of_node_put(rem);
>   if (IS_ERR(pdata->asd[i]))
>   goto cleanup;
> +
> + i++;
>   }
>  
> - of_node_put(endpoint);
>   return pdata;
>  
>  cleanup:
> diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c 
> b/drivers/media/platform/ti/davinci/vpif_capture.c
> index c28794b6677b7..078ae11cd0787 100644
> --- a/drivers/media/platform/ti/davinci/vpif_capture.c
> +++ b/drivers/media/platform/ti/davinci/vpif_capture.c
> @@ -1517,16 +1517,12 @@ vpif_capture_get_pdata(struct platform_device *pdev,
>   if (!pdata->subdev_info)
>   return NULL;
>  
> - for (i = 0; i < VPIF_CAPTURE_NUM_CHANNELS; i++) {
> + i = 0;
> + for_each_endpoint_of_node(pdev->dev.of_node, endpoint) {
>   struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
>   unsigned int flags;
>   int err;
>  
> - endpoint = of_graph_get_next_endpoint(pdev->dev.of_node,
> -   endpoint);
> - if (!endpoint)
> - break;
> -
>   rem = of_graph_get_remote_port_parent(endpoint);
>   if (!rem) {
>   dev_dbg(>dev, "Remote device at %pOF not found\n",
> @@ -1577,6 +1573,10 @@ vpif_capture_get_pdata(struct platform_device *pdev,
>   goto err_cleanup;
>  
>   of_node_put(rem);
> +
> + i++;
> + if (i >= VPIF_CAPTURE_NUM_CHANNELS)
> + break;
>   }
>  
>  done:

-- 
Regards,

Laurent Pinchart


Re: [PATCH v2 resend 3/8] media: platform: microchip: use for_each_endpoint_of_node()

2024-05-28 Thread Laurent Pinchart
Hello Morimoto-san,

Thank you for the patch.

On Tue, May 28, 2024 at 11:55:37PM +, Kuninori Morimoto wrote:
> We already have for_each_endpoint_of_node(), don't use
> of_graph_get_next_endpoint() directly. Replace it.
> 
> Signed-off-by: Kuninori Morimoto 
> ---
>  .../microchip/microchip-sama5d2-isc.c | 19 +++
>  .../microchip/microchip-sama7g5-isc.c | 19 +++
>  2 files changed, 14 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c 
> b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
> index 5ac149cf3647f..d9298771f5097 100644
> --- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
> +++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
> @@ -356,30 +356,26 @@ static int isc_parse_dt(struct device *dev, struct 
> isc_device *isc)
>   struct device_node *epn = NULL;

There's no need anymore to initialize epn to NULL. Same in
microchip-sama7g5-isc.c. With this addressed,

Reviewed-by: Laurent Pinchart 

>   struct isc_subdev_entity *subdev_entity;
>   unsigned int flags;
> - int ret;
>  
>   INIT_LIST_HEAD(>subdev_entities);
>  
> - while (1) {
> + for_each_endpoint_of_node(np, epn) {
>   struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
> -
> - epn = of_graph_get_next_endpoint(np, epn);
> - if (!epn)
> - return 0;
> + int ret;
>  
>   ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
>_epn);
>   if (ret) {
> - ret = -EINVAL;
> + of_node_put(epn);
>   dev_err(dev, "Could not parse the endpoint\n");
> - break;
> + return -EINVAL;
>   }
>  
>   subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
>GFP_KERNEL);
>   if (!subdev_entity) {
> - ret = -ENOMEM;
> - break;
> + of_node_put(epn);
> + return -ENOMEM;
>   }
>   subdev_entity->epn = epn;
>  
> @@ -400,9 +396,8 @@ static int isc_parse_dt(struct device *dev, struct 
> isc_device *isc)
>  
>   list_add_tail(_entity->list, >subdev_entities);
>   }
> - of_node_put(epn);
>  
> - return ret;
> + return 0;
>  }
>  
>  static int microchip_isc_probe(struct platform_device *pdev)
> diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c 
> b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
> index 73445f33d26ba..36204fee10aa2 100644
> --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
> +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
> @@ -339,33 +339,29 @@ static int xisc_parse_dt(struct device *dev, struct 
> isc_device *isc)
>   struct device_node *epn = NULL;
>   struct isc_subdev_entity *subdev_entity;
>   unsigned int flags;
> - int ret;
>   bool mipi_mode;
>  
>   INIT_LIST_HEAD(>subdev_entities);
>  
>   mipi_mode = of_property_read_bool(np, "microchip,mipi-mode");
>  
> - while (1) {
> + for_each_endpoint_of_node(np, epn) {
>   struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
> -
> - epn = of_graph_get_next_endpoint(np, epn);
> - if (!epn)
> - return 0;
> + int ret;
>  
>   ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
>_epn);
>   if (ret) {
> - ret = -EINVAL;
> + of_node_put(epn);
>   dev_err(dev, "Could not parse the endpoint\n");
> - break;
> + return -EINVAL;
>   }
>  
>   subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
>GFP_KERNEL);
>   if (!subdev_entity) {
> - ret = -ENOMEM;
> - break;
> + of_node_put(epn);
> + return -ENOMEM;
>   }
>   subdev_entity->epn = epn;
>  
> @@ -389,9 +385,8 @@ static int xisc_parse_dt(struct device *dev, struct 
> isc_device *isc)
>  
>   list_add_tail(_entity->list, >subdev_entities);
>   }
> - of_node_put(epn);
>  
> - return ret;
> + return 0;
>  }
>  
>  static int microchip_xisc_probe(struct platform_device *pdev)

-- 
Regards,

Laurent Pinchart


Re: [PATCH v2 resend 2/8] hwtracing: use for_each_endpoint_of_node()

2024-05-28 Thread Laurent Pinchart
Hi Morimoto-san,

Thank you for the patch.

On Tue, May 28, 2024 at 11:55:32PM +, Kuninori Morimoto wrote:
> We already have for_each_endpoint_of_node(), don't use
> of_graph_get_next_endpoint() directly. Replace it.
> 
> Signed-off-by: Kuninori Morimoto 
> Reviewed-by: Suzuki K Poulose 
> ---
>  drivers/hwtracing/coresight/coresight-platform.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-platform.c 
> b/drivers/hwtracing/coresight/coresight-platform.c
> index 9d550f5697fa8..e9683e613d520 100644
> --- a/drivers/hwtracing/coresight/coresight-platform.c
> +++ b/drivers/hwtracing/coresight/coresight-platform.c
> @@ -275,7 +275,7 @@ static int of_get_coresight_platform_data(struct device 
> *dev,
>*/
>   if (!parent) {
>   /*
> -  * Avoid warnings in of_graph_get_next_endpoint()
> +  * Avoid warnings in for_each_endpoint_of_node()
>* if the device doesn't have any graph connections
>*/
>   if (!of_graph_is_present(node))
> @@ -286,7 +286,7 @@ static int of_get_coresight_platform_data(struct device 
> *dev,
>   }
>  
>   /* Iterate through each output port to discover topology */
> - while ((ep = of_graph_get_next_endpoint(parent, ep))) {
> + for_each_endpoint_of_node(parent, ep) {
>   /*
>* Legacy binding mixes input/output ports under the
>* same parent. So, skip the input ports if we are dealing

I think there's a bug below. The loop contains

ret = of_coresight_parse_endpoint(dev, ep, pdata);
if (ret)
return ret;

which leaks the reference to ep. This is not introduced by this patch,
so

Reviewed-by: Laurent Pinchart 

-- 
Regards,

Laurent Pinchart


Re: [RFC PATCH 7/8] rust: add firmware abstractions

2024-05-28 Thread FUJITA Tomonori
On Tue, 28 May 2024 14:19:24 +0200
Danilo Krummrich  wrote:

> On Tue, May 28, 2024 at 08:01:26PM +0900, FUJITA Tomonori wrote:
>> On Mon, 27 May 2024 21:22:47 +0200
>> Danilo Krummrich  wrote:
>> 
>> >> > +/// Abstraction around a C firmware struct.
>> >> > +///
>> >> > +/// This is a simple abstraction around the C firmware API. Just like 
>> >> > with the C API, firmware can
>> >> > +/// be requested. Once requested the abstraction provides direct 
>> >> > access to the firmware buffer as
>> >> > +/// `&[u8]`. Alternatively, the firmware can be copied to a new buffer 
>> >> > using `Firmware::copy`. The
>> >> > +/// firmware is released once [`Firmware`] is dropped.
>> >> > +///
>> >> > +/// # Examples
>> >> > +///
>> >> > +/// ```
>> >> > +/// let fw = Firmware::request("path/to/firmware.bin", dev.as_ref())?;
>> >> > +/// driver_load_firmware(fw.data());
>> >> > +/// ```
>> >> > +pub struct Firmware(Opaque<*const bindings::firmware>);
>> >> 
>> >> Wrapping a raw pointer is not the intended use of Qpaque type?
>> >> 
>> > 
>> > Indeed, will fix this in v2 and use NonNull instead. I'll also offload 
>> > most of
>> > the boilerplate in the 'request' functions to some common 
>> > 'request_internal' one.
>> 
>> You might need to add 'Invariants' comment on Firmware struct.
> 
> Which ones do you think should be documented?

Something like the comment for struct Page looks fine to me. But the
Rust reviewers might have a different opinion.

/// The pointer is valid, and has ownership over the page.


Re: [PATCH v2 resend 1/8] gpu: drm: use for_each_endpoint_of_node()

2024-05-28 Thread Laurent Pinchart
Hello Morimoto-san,

Thank you for the patch.

On Tue, May 28, 2024 at 11:55:26PM +, Kuninori Morimoto wrote:
> We already have for_each_endpoint_of_node(), don't use
> of_graph_get_next_endpoint() directly. Replace it.
> 
> Signed-off-by: Kuninori Morimoto 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 050ca7eafac58..5f8002f6bb7a5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -242,8 +242,7 @@ static void omapdss_walk_device(struct device *dev, 
> struct device_node *node,
>  
>   of_node_put(n);
>  
> - n = NULL;
> - while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
> + for_each_endpoint_of_node(node, n) {
>   struct device_node *pn = of_graph_get_remote_port_parent(n);
>  
>   if (!pn)

-- 
Regards,

Laurent Pinchart


Re: [RFC PATCH 7/8] rust: add firmware abstractions

2024-05-28 Thread FUJITA Tomonori
Hi,

On Tue, 28 May 2024 14:45:02 +0200
Greg KH  wrote:

> On Tue, May 28, 2024 at 02:19:24PM +0200, Danilo Krummrich wrote:
>> However, if you have a driver that needs the firmware abstractions, I would 
>> be
>> surprised if there were any hesitations to already merge the minimum device
>> abstractions [1] and this one (once reviewed) without the rest. At least 
>> there
>> aren't any from my side.
>> 
>> [1] 
>> https://lore.kernel.org/rust-for-linux/20240520172554.182094-2-d...@redhat.com/
> 
> No, the device abstractions are NOT ready for merging just yet, sorry,
> if for no other reason than a non-RFC has never been posted :)

Indeed, I understand that you aren't convinced.

We can start with much simpler device abstractions than the above
minimum for the firmware abstractions.

All the firmware abstractions need is wrapping C's pointer to a device
object with Rust struct only during a caller knows the pointer is
valid. No play with the reference count of a struct device.

For a Rust PHY driver, you know that you have a valid pointer to C's
device object of C's PHY device during the probe callback. The driver
creates a Rust device object to wrap the C pointer to the C's device
object and passes it to the firmware abstractions. The firmware
abstractions gets the C's pointer from the Rust object and calls C's
function to load firmware, returns the result.

You have concerns about the simple code like the following?


diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs
new file mode 100644
index ..6144437984a9
--- /dev/null
+++ b/rust/kernel/device.rs
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0
+
+//! Generic devices that are part of the kernel's driver model.
+//!
+//! C header: [`include/linux/device.h`](srctree/include/linux/device.h)
+
+use crate::types::Opaque;
+
+#[repr(transparent)]
+pub struct Device(Opaque);
+
+impl Device {
+/// Creates a new [`Device`] instance from a raw pointer.
+///
+/// # Safety
+///
+/// For the duration of 'a, the pointer must point at a valid `device`.
+pub unsafe fn from_raw<'a>(ptr: *mut bindings::device) -> &'a Self {
+// CAST: `Self` is a `repr(transparent)` wrapper around 
`bindings::device`.
+let ptr = ptr.cast::();
+// SAFETY: by the function requirements the pointer is valid and we 
have unique access for
+// the duration of `'a`.
+unsafe {  *ptr }
+}
+
+/// Returns the raw pointer to the device.
+pub fn as_raw() -> *mut bindings::device {
+self.0.get()
+}
+}


[drm-misc:drm-misc-next 22/29] drm_hdmi_state_helper.c:undefined reference to `drm_hdmi_avi_infoframe_colorimetry'

2024-05-28 Thread kernel test robot
tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head:   336dca397dcefc5d7436be1fee3c814ed6512996
commit: f378b77227bc4732922c57f92be89438bb1018a1 [22/29] drm/connector: hdmi: 
Add Infoframes generation
config: arc-randconfig-002-20240529 
(https://download.01.org/0day-ci/archive/20240529/202405290803.c3178dyt-...@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240529/202405290803.c3178dyt-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202405290803.c3178dyt-...@intel.com/

All errors (new ones prefixed by >>):

   arc-elf-ld: drivers/gpu/drm/tests/drm_connector_test.o: in function 
`drm_test_connector_hdmi_compute_mode_clock_yuv422_12_bpc':
   drm_connector_test.c:(.text+0x230): undefined reference to 
`drm_hdmi_compute_mode_clock'
   arc-elf-ld: drm_connector_test.c:(.text+0x230): undefined reference to 
`drm_hdmi_compute_mode_clock'
   arc-elf-ld: drivers/gpu/drm/tests/drm_connector_test.o: in function 
`drm_test_connector_hdmi_compute_mode_clock_yuv422_10_bpc':
   drm_connector_test.c:(.text+0x378): undefined reference to 
`drm_hdmi_compute_mode_clock'
   arc-elf-ld: drm_connector_test.c:(.text+0x378): undefined reference to 
`drm_hdmi_compute_mode_clock'
   arc-elf-ld: drivers/gpu/drm/tests/drm_connector_test.o: in function 
`drm_test_connector_hdmi_compute_mode_clock_yuv422_8_bpc':
   drm_connector_test.c:(.text+0x4c0): undefined reference to 
`drm_hdmi_compute_mode_clock'
   arc-elf-ld: 
drivers/gpu/drm/tests/drm_connector_test.o:drm_connector_test.c:(.text+0x4c0): 
more undefined references to `drm_hdmi_compute_mode_clock' follow
   arc-elf-ld: drivers/gpu/drm/display/drm_hdmi_state_helper.o: in function 
`drm_atomic_helper_connector_hdmi_check':
>> drm_hdmi_state_helper.c:(.text+0x824): undefined reference to 
>> `drm_hdmi_avi_infoframe_colorimetry'
>> arc-elf-ld: drm_hdmi_state_helper.c:(.text+0x824): undefined reference to 
>> `drm_hdmi_avi_infoframe_colorimetry'
>> arc-elf-ld: drm_hdmi_state_helper.c:(.text+0x82c): undefined reference to 
>> `drm_hdmi_avi_infoframe_bars'
>> arc-elf-ld: drm_hdmi_state_helper.c:(.text+0x82c): undefined reference to 
>> `drm_hdmi_avi_infoframe_bars'
>> arc-elf-ld: drm_hdmi_state_helper.c:(.text+0x866): undefined reference to 
>> `drm_hdmi_infoframe_set_hdr_metadata'
>> arc-elf-ld: drm_hdmi_state_helper.c:(.text+0x866): undefined reference to 
>> `drm_hdmi_infoframe_set_hdr_metadata'

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for DRM_DISPLAY_HDMI_STATE_HELPER
   Depends on [n]: HAS_IOMEM [=y] && DRM [=y] && DRM_DISPLAY_HELPER [=y] && 
DRM_DISPLAY_HDMI_HELPER [=n]
   Selected by [y]:
   - DRM_KUNIT_TEST [=y] && HAS_IOMEM [=y] && DRM [=y] && KUNIT [=y] && MMU [=y]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Re: [PATCH v2 resend 1/8] gpu: drm: use for_each_endpoint_of_node()

2024-05-28 Thread Dmitry Baryshkov
On Tue, May 28, 2024 at 11:55:26PM +, Kuninori Morimoto wrote:
> We already have for_each_endpoint_of_node(), don't use
> of_graph_get_next_endpoint() directly. Replace it.
> 
> Signed-off-by: Kuninori Morimoto 
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

Acked-by: Dmitry Baryshkov 

-- 
With best wishes
Dmitry


[PATCH v2 resend 5/8] media: platform: xilinx: use for_each_endpoint_of_node()

2024-05-28 Thread Kuninori Morimoto
We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/platform/xilinx/xilinx-vipp.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c 
b/drivers/media/platform/xilinx/xilinx-vipp.c
index 996684a730383..38818b82a575e 100644
--- a/drivers/media/platform/xilinx/xilinx-vipp.c
+++ b/drivers/media/platform/xilinx/xilinx-vipp.c
@@ -205,12 +205,7 @@ static int xvip_graph_build_dma(struct 
xvip_composite_device *xdev)
 
dev_dbg(xdev->dev, "creating links for DMA engines\n");
 
-   while (1) {
-   /* Get the next endpoint and parse its link. */
-   ep = of_graph_get_next_endpoint(node, ep);
-   if (ep == NULL)
-   break;
-
+   for_each_endpoint_of_node(node, ep) {
dev_dbg(xdev->dev, "processing endpoint %pOF\n", ep);
 
ret = v4l2_fwnode_parse_link(of_fwnode_handle(ep), );
-- 
2.43.0



[PATCH v2 resend 8/8] fbdev: omapfb: use of_graph_get_remote_port()

2024-05-28 Thread Kuninori Morimoto
We already have of_graph_get_remote_port(), Let's use it.

Signed-off-by: Kuninori Morimoto 
---
 drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 15 +--
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c 
b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
index 14965a3fd05b7..4040e247e026e 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
@@ -117,19 +117,6 @@ u32 dss_of_port_get_port_number(struct device_node *port)
return reg;
 }
 
-static struct device_node *omapdss_of_get_remote_port(const struct device_node 
*node)
-{
-   struct device_node *np;
-
-   np = of_graph_get_remote_endpoint(node);
-   if (!np)
-   return NULL;
-
-   np = of_get_next_parent(np);
-
-   return np;
-}
-
 struct omap_dss_device *
 omapdss_of_find_source_for_first_ep(struct device_node *node)
 {
@@ -141,7 +128,7 @@ omapdss_of_find_source_for_first_ep(struct device_node 
*node)
if (!ep)
return ERR_PTR(-EINVAL);
 
-   src_port = omapdss_of_get_remote_port(ep);
+   src_port = of_graph_get_remote_port(ep);
if (!src_port) {
of_node_put(ep);
return ERR_PTR(-EINVAL);
-- 
2.43.0



[PATCH v2 resend 7/8] video: fbdev: use for_each_endpoint_of_node()

2024-05-28 Thread Kuninori Morimoto
We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto 
---
 drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c 
b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
index 09f719af0d0c9..d80720c843235 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
@@ -149,8 +149,7 @@ static void __init omapdss_walk_device(struct device_node 
*node, bool root)
 
of_node_put(n);
 
-   n = NULL;
-   while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
+   for_each_endpoint_of_node(node, n) {
struct device_node *pn;
 
pn = of_graph_get_remote_port_parent(n);
-- 
2.43.0



[PATCH v2 resend 6/8] staging: media: atmel: use for_each_endpoint_of_node()

2024-05-28 Thread Kuninori Morimoto
We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto 
---
 drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c | 6 +-
 drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c | 6 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c 
b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
index 31b2b48085c59..cbfbec0c6cb57 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
@@ -340,13 +340,9 @@ static int isc_parse_dt(struct device *dev, struct 
isc_device *isc)
 
INIT_LIST_HEAD(>subdev_entities);
 
-   while (1) {
+   for_each_endpoint_of_node(np, epn) {
struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
 
-   epn = of_graph_get_next_endpoint(np, epn);
-   if (!epn)
-   return 0;
-
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 _epn);
if (ret) {
diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c 
b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
index 020034f631f57..7c477b1d3c484 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
@@ -326,13 +326,9 @@ static int xisc_parse_dt(struct device *dev, struct 
isc_device *isc)
 
mipi_mode = of_property_read_bool(np, "microchip,mipi-mode");
 
-   while (1) {
+   for_each_endpoint_of_node(np, epn) {
struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
 
-   epn = of_graph_get_next_endpoint(np, epn);
-   if (!epn)
-   return 0;
-
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 _epn);
if (ret) {
-- 
2.43.0



[PATCH v2 resend 4/8] media: platform: ti: use for_each_endpoint_of_node()

2024-05-28 Thread Kuninori Morimoto
We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto 
---
 drivers/media/platform/ti/am437x/am437x-vpfe.c   | 12 +---
 drivers/media/platform/ti/davinci/vpif_capture.c | 12 ++--
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c 
b/drivers/media/platform/ti/am437x/am437x-vpfe.c
index 77e12457d1495..009ff68a2b43c 100644
--- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
@@ -2287,7 +2287,7 @@ static const struct v4l2_async_notifier_operations 
vpfe_async_ops = {
 static struct vpfe_config *
 vpfe_get_pdata(struct vpfe_device *vpfe)
 {
-   struct device_node *endpoint = NULL;
+   struct device_node *endpoint;
struct device *dev = vpfe->pdev;
struct vpfe_subdev_info *sdinfo;
struct vpfe_config *pdata;
@@ -2306,14 +2306,11 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
if (!pdata)
return NULL;
 
-   for (i = 0; ; i++) {
+   i = 0;
+   for_each_endpoint_of_node(dev->of_node, endpoint) {
struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
struct device_node *rem;
 
-   endpoint = of_graph_get_next_endpoint(dev->of_node, endpoint);
-   if (!endpoint)
-   break;
-
sdinfo = >sub_devs[i];
sdinfo->grp_id = 0;
 
@@ -2371,9 +2368,10 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
of_node_put(rem);
if (IS_ERR(pdata->asd[i]))
goto cleanup;
+
+   i++;
}
 
-   of_node_put(endpoint);
return pdata;
 
 cleanup:
diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c 
b/drivers/media/platform/ti/davinci/vpif_capture.c
index c28794b6677b7..078ae11cd0787 100644
--- a/drivers/media/platform/ti/davinci/vpif_capture.c
+++ b/drivers/media/platform/ti/davinci/vpif_capture.c
@@ -1517,16 +1517,12 @@ vpif_capture_get_pdata(struct platform_device *pdev,
if (!pdata->subdev_info)
return NULL;
 
-   for (i = 0; i < VPIF_CAPTURE_NUM_CHANNELS; i++) {
+   i = 0;
+   for_each_endpoint_of_node(pdev->dev.of_node, endpoint) {
struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
unsigned int flags;
int err;
 
-   endpoint = of_graph_get_next_endpoint(pdev->dev.of_node,
- endpoint);
-   if (!endpoint)
-   break;
-
rem = of_graph_get_remote_port_parent(endpoint);
if (!rem) {
dev_dbg(>dev, "Remote device at %pOF not found\n",
@@ -1577,6 +1573,10 @@ vpif_capture_get_pdata(struct platform_device *pdev,
goto err_cleanup;
 
of_node_put(rem);
+
+   i++;
+   if (i >= VPIF_CAPTURE_NUM_CHANNELS)
+   break;
}
 
 done:
-- 
2.43.0



[PATCH v2 resend 3/8] media: platform: microchip: use for_each_endpoint_of_node()

2024-05-28 Thread Kuninori Morimoto
We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto 
---
 .../microchip/microchip-sama5d2-isc.c | 19 +++
 .../microchip/microchip-sama7g5-isc.c | 19 +++
 2 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c 
b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index 5ac149cf3647f..d9298771f5097 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -356,30 +356,26 @@ static int isc_parse_dt(struct device *dev, struct 
isc_device *isc)
struct device_node *epn = NULL;
struct isc_subdev_entity *subdev_entity;
unsigned int flags;
-   int ret;
 
INIT_LIST_HEAD(>subdev_entities);
 
-   while (1) {
+   for_each_endpoint_of_node(np, epn) {
struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
-
-   epn = of_graph_get_next_endpoint(np, epn);
-   if (!epn)
-   return 0;
+   int ret;
 
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 _epn);
if (ret) {
-   ret = -EINVAL;
+   of_node_put(epn);
dev_err(dev, "Could not parse the endpoint\n");
-   break;
+   return -EINVAL;
}
 
subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
 GFP_KERNEL);
if (!subdev_entity) {
-   ret = -ENOMEM;
-   break;
+   of_node_put(epn);
+   return -ENOMEM;
}
subdev_entity->epn = epn;
 
@@ -400,9 +396,8 @@ static int isc_parse_dt(struct device *dev, struct 
isc_device *isc)
 
list_add_tail(_entity->list, >subdev_entities);
}
-   of_node_put(epn);
 
-   return ret;
+   return 0;
 }
 
 static int microchip_isc_probe(struct platform_device *pdev)
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c 
b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index 73445f33d26ba..36204fee10aa2 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -339,33 +339,29 @@ static int xisc_parse_dt(struct device *dev, struct 
isc_device *isc)
struct device_node *epn = NULL;
struct isc_subdev_entity *subdev_entity;
unsigned int flags;
-   int ret;
bool mipi_mode;
 
INIT_LIST_HEAD(>subdev_entities);
 
mipi_mode = of_property_read_bool(np, "microchip,mipi-mode");
 
-   while (1) {
+   for_each_endpoint_of_node(np, epn) {
struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
-
-   epn = of_graph_get_next_endpoint(np, epn);
-   if (!epn)
-   return 0;
+   int ret;
 
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 _epn);
if (ret) {
-   ret = -EINVAL;
+   of_node_put(epn);
dev_err(dev, "Could not parse the endpoint\n");
-   break;
+   return -EINVAL;
}
 
subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
 GFP_KERNEL);
if (!subdev_entity) {
-   ret = -ENOMEM;
-   break;
+   of_node_put(epn);
+   return -ENOMEM;
}
subdev_entity->epn = epn;
 
@@ -389,9 +385,8 @@ static int xisc_parse_dt(struct device *dev, struct 
isc_device *isc)
 
list_add_tail(_entity->list, >subdev_entities);
}
-   of_node_put(epn);
 
-   return ret;
+   return 0;
 }
 
 static int microchip_xisc_probe(struct platform_device *pdev)
-- 
2.43.0



[PATCH v2 resend 2/8] hwtracing: use for_each_endpoint_of_node()

2024-05-28 Thread Kuninori Morimoto
We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto 
Reviewed-by: Suzuki K Poulose 
---
 drivers/hwtracing/coresight/coresight-platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-platform.c 
b/drivers/hwtracing/coresight/coresight-platform.c
index 9d550f5697fa8..e9683e613d520 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -275,7 +275,7 @@ static int of_get_coresight_platform_data(struct device 
*dev,
 */
if (!parent) {
/*
-* Avoid warnings in of_graph_get_next_endpoint()
+* Avoid warnings in for_each_endpoint_of_node()
 * if the device doesn't have any graph connections
 */
if (!of_graph_is_present(node))
@@ -286,7 +286,7 @@ static int of_get_coresight_platform_data(struct device 
*dev,
}
 
/* Iterate through each output port to discover topology */
-   while ((ep = of_graph_get_next_endpoint(parent, ep))) {
+   for_each_endpoint_of_node(parent, ep) {
/*
 * Legacy binding mixes input/output ports under the
 * same parent. So, skip the input ports if we are dealing
-- 
2.43.0



[PATCH v2 resend 1/8] gpu: drm: use for_each_endpoint_of_node()

2024-05-28 Thread Kuninori Morimoto
We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto 
---
 drivers/gpu/drm/omapdrm/dss/base.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 050ca7eafac58..5f8002f6bb7a5 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -242,8 +242,7 @@ static void omapdss_walk_device(struct device *dev, struct 
device_node *node,
 
of_node_put(n);
 
-   n = NULL;
-   while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
+   for_each_endpoint_of_node(node, n) {
struct device_node *pn = of_graph_get_remote_port_parent(n);
 
if (!pn)
-- 
2.43.0



[PATCH v2 resend 0/8] use for_each_endpoint_of_node()

2024-05-28 Thread Kuninori Morimoto


Hi Rob, Helge

This is resend of v2 patch-set

We already have for_each_endpoint_of_node(), but some drivers are
not using it. This patch-set replace it.

This patch-set is related to "OF" (= Rob), but many driveres are for
"MultiMedia" (= Helge). I'm not sure who handle these.

I will re-post this patch-set because I couldn't find these on
linus/master branch.

[o] done
[*] this patch-set

[o] tidyup of_graph_get_endpoint_count()
[o] replace endpoint func - use endpoint_by_regs()
[*] replace endpoint func - use for_each()
[ ] rename endpoint func to device_endpoint
[ ] add new port function
[ ] add new endpont function
[ ] remove of_graph_get_next_device_endpoint()

v1 -> v2
- fixup TI patch

Link: https://lore.kernel.org/r/8734sf6mgn.wl-kuninori.morimoto...@renesas.com

Kuninori Morimoto (8):
  gpu: drm: use for_each_endpoint_of_node()
  hwtracing: use for_each_endpoint_of_node()
  media: platform: microchip: use for_each_endpoint_of_node()
  media: platform: ti: use for_each_endpoint_of_node()
  media: platform: xilinx: use for_each_endpoint_of_node()
  staging: media: atmel: use for_each_endpoint_of_node()
  video: fbdev: use for_each_endpoint_of_node()
  fbdev: omapfb: use of_graph_get_remote_port()

 drivers/gpu/drm/omapdrm/dss/base.c|  3 +--
 .../hwtracing/coresight/coresight-platform.c  |  4 ++--
 .../microchip/microchip-sama5d2-isc.c | 19 +++
 .../microchip/microchip-sama7g5-isc.c | 19 +++
 .../media/platform/ti/am437x/am437x-vpfe.c| 12 +---
 .../media/platform/ti/davinci/vpif_capture.c  | 12 ++--
 drivers/media/platform/xilinx/xilinx-vipp.c   |  7 +--
 .../deprecated/atmel/atmel-sama5d2-isc.c  |  6 +-
 .../deprecated/atmel/atmel-sama7g5-isc.c  |  6 +-
 drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 15 +--
 .../omap2/omapfb/dss/omapdss-boot-init.c  |  3 +--
 11 files changed, 33 insertions(+), 73 deletions(-)

-- 
2.43.0



[PATCH v2 2/3] dt-bindings: display: panel-simple: drop several eDP panels

2024-05-28 Thread Dmitry Baryshkov
The panel-simple.yaml includes legacy bindings for several eDP panels
which were never used in DT files present in Linux tree and most likely
have never been used with the upstream kernel. Drop compatibles for
these panels in favour of using a generic "edp-panel" device on the AUX
bus.

Signed-off-by: Dmitry Baryshkov 
---
 .../devicetree/bindings/display/panel/panel-simple.yaml| 10 --
 1 file changed, 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index 5067f5c0a272..e5ed51226433 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -50,13 +50,9 @@ properties:
 # AU Optronics Corporation 11.6" HD (1366x768) color TFT-LCD panel
   - auo,b116xw03
 # AU Optronics Corporation 13.3" FHD (1920x1080) color TFT-LCD panel
-  - auo,b133han05
-# AU Optronics Corporation 13.3" FHD (1920x1080) color TFT-LCD panel
   - auo,b133htn01
 # AU Optronics Corporation 13.3" WXGA (1366x768) TFT LCD panel
   - auo,b133xtn01
-# AU Optronics Corporation 14.0" FHD (1920x1080) color TFT-LCD panel
-  - auo,b140han06
 # AU Optronics Corporation 7.0" FHD (800 x 480) TFT LCD panel
   - auo,g070vvn01
 # AU Optronics Corporation 10.1" (1280x800) color TFT LCD panel
@@ -172,8 +168,6 @@ properties:
   - hannstar,hsd100pxn1
 # Hitachi Ltd. Corporation 9" WVGA (800x480) TFT LCD panel
   - hit,tx23d38vm0caa
-# InfoVision Optoelectronics M133NWF4 R0 13.3" FHD (1920x1080) TFT LCD 
panel
-  - ivo,m133nwf4-r0
 # Innolux AT043TN24 4.3" WQVGA TFT LCD panel
   - innolux,at043tn24
 # Innolux AT070TN92 7.0" WQVGA TFT LCD panel
@@ -310,16 +304,12 @@ properties:
   - sharp,lq101k1ly04
 # Sharp 12.3" (2400x1600 pixels) TFT LCD panel
   - sharp,lq123p1jx31
-# Sharp 14" (1920x1080 pixels) TFT LCD panel
-  - sharp,lq140m1jw46
 # Sharp LS020B1DD01D 2.0" HQVGA TFT LCD panel
   - sharp,ls020b1dd01d
 # Shelly SCA07010-BFN-LNN 7.0" WVGA TFT LCD panel
   - shelly,sca07010-bfn-lnn
 # Starry KR070PE2T 7" WVGA TFT LCD panel
   - starry,kr070pe2t
-# Starry 12.2" (1920x1200 pixels) TFT LCD panel
-  - starry,kr122ea0sra
 # Startek KD070WVFPA043-C069A 7" TFT LCD panel
   - startek,kd070wvfpa
 # Team Source Display Technology TST043015CMHX 4.3" WQVGA TFT LCD panel

-- 
2.39.2



[PATCH v2 3/3] drm/panel-edp: drop several legacy panels

2024-05-28 Thread Dmitry Baryshkov
The panel-edp driver supports legacy compatible strings for several eDP
panels which were never used in DT files present in Linux tree and most
likely have never been used with the upstream kernel. Drop compatibles
for these panels in favour of using a generic "edp-panel" device on the
AUX bus.

Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/panel/panel-edp.c | 173 ++
 1 file changed, 7 insertions(+), 166 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c 
b/drivers/gpu/drm/panel/panel-edp.c
index 95b25ec67168..120780e5d34d 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -1059,33 +1059,6 @@ static const struct panel_desc auo_b116xak01 = {
},
 };
 
-static const struct drm_display_mode auo_b133han05_mode = {
-   .clock = 142600,
-   .hdisplay = 1920,
-   .hsync_start = 1920 + 58,
-   .hsync_end = 1920 + 58 + 42,
-   .htotal = 1920 + 58 + 42 + 60,
-   .vdisplay = 1080,
-   .vsync_start = 1080 + 3,
-   .vsync_end = 1080 + 3 + 5,
-   .vtotal = 1080 + 3 + 5 + 54,
-};
-
-static const struct panel_desc auo_b133han05 = {
-   .modes = _b133han05_mode,
-   .num_modes = 1,
-   .bpc = 8,
-   .size = {
-   .width = 293,
-   .height = 165,
-   },
-   .delay = {
-   .hpd_reliable = 100,
-   .enable = 20,
-   .unprepare = 50,
-   },
-};
-
 static const struct drm_display_mode auo_b133htn01_mode = {
.clock = 150660,
.hdisplay = 1920,
@@ -1135,33 +1108,6 @@ static const struct panel_desc auo_b133xtn01 = {
},
 };
 
-static const struct drm_display_mode auo_b140han06_mode = {
-   .clock = 141000,
-   .hdisplay = 1920,
-   .hsync_start = 1920 + 16,
-   .hsync_end = 1920 + 16 + 16,
-   .htotal = 1920 + 16 + 16 + 152,
-   .vdisplay = 1080,
-   .vsync_start = 1080 + 3,
-   .vsync_end = 1080 + 3 + 14,
-   .vtotal = 1080 + 3 + 14 + 19,
-};
-
-static const struct panel_desc auo_b140han06 = {
-   .modes = _b140han06_mode,
-   .num_modes = 1,
-   .bpc = 8,
-   .size = {
-   .width = 309,
-   .height = 174,
-   },
-   .delay = {
-   .hpd_reliable = 100,
-   .enable = 20,
-   .unprepare = 50,
-   },
-};
-
 static const struct drm_display_mode boe_nv101wxmn51_modes[] = {
{
.clock = 71900,
@@ -1428,33 +1374,6 @@ static const struct panel_desc innolux_p120zdg_bf1 = {
},
 };
 
-static const struct drm_display_mode ivo_m133nwf4_r0_mode = {
-   .clock = 138778,
-   .hdisplay = 1920,
-   .hsync_start = 1920 + 24,
-   .hsync_end = 1920 + 24 + 48,
-   .htotal = 1920 + 24 + 48 + 88,
-   .vdisplay = 1080,
-   .vsync_start = 1080 + 3,
-   .vsync_end = 1080 + 3 + 12,
-   .vtotal = 1080 + 3 + 12 + 17,
-   .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
-};
-
-static const struct panel_desc ivo_m133nwf4_r0 = {
-   .modes = _m133nwf4_r0_mode,
-   .num_modes = 1,
-   .bpc = 8,
-   .size = {
-   .width = 294,
-   .height = 165,
-   },
-   .delay = {
-   .hpd_absent = 200,
-   .unprepare = 500,
-   },
-};
-
 static const struct drm_display_mode kingdisplay_kd116n21_30nv_a010_mode = {
.clock = 81000,
.hdisplay = 1366,
@@ -1703,75 +1622,6 @@ static const struct panel_desc sharp_lq123p1jx31 = {
},
 };
 
-static const struct drm_display_mode sharp_lq140m1jw46_mode[] = {
-   {
-   .clock = 346500,
-   .hdisplay = 1920,
-   .hsync_start = 1920 + 48,
-   .hsync_end = 1920 + 48 + 32,
-   .htotal = 1920 + 48 + 32 + 80,
-   .vdisplay = 1080,
-   .vsync_start = 1080 + 3,
-   .vsync_end = 1080 + 3 + 5,
-   .vtotal = 1080 + 3 + 5 + 69,
-   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
-   }, {
-   .clock = 144370,
-   .hdisplay = 1920,
-   .hsync_start = 1920 + 48,
-   .hsync_end = 1920 + 48 + 32,
-   .htotal = 1920 + 48 + 32 + 80,
-   .vdisplay = 1080,
-   .vsync_start = 1080 + 3,
-   .vsync_end = 1080 + 3 + 5,
-   .vtotal = 1080 + 3 + 5 + 69,
-   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
-   },
-};
-
-static const struct panel_desc sharp_lq140m1jw46 = {
-   .modes = sharp_lq140m1jw46_mode,
-   .num_modes = ARRAY_SIZE(sharp_lq140m1jw46_mode),
-   .bpc = 8,
-   .size = {
-   .width = 309,
-   .height = 174,
-   },
-   .delay = {
-   .hpd_absent = 80,
-   .enable = 50,
-   .unprepare = 500,
-   },
-};
-
-static const struct drm_display_mode starry_kr122ea0sra_mode = {
-

[PATCH v2 0/3] drm/panel-edp: remove several legacy compatibles used by the driver

2024-05-28 Thread Dmitry Baryshkov
There are two ways to describe an eDP panel in device tree. The
recommended way is to add a device on the AUX bus, ideally using the
edp-panel compatible. The legacy way is to define a top-level platform
device for the panel.

Document that adding support for eDP panels in a legacy way is strongly
discouraged (if not forbidden at all).

While we are at it, also drop legacy compatible strings and bindings for
five panels. These compatible strings were never used by a DT file
present in Linux kernel and most likely were never used with the
upstream Linux kernel.

The following compatibles were never used by the devices supported by
the upstream kernel and are a subject to possible removal:

- lg,lp097qx1-spa1
- samsung,lsn122dl01-c01
- sharp,ld-d5116z01b

I'm considering dropping them later, unless there is a good reason not
to do so.

Signed-off-by: Dmitry Baryshkov 
---
Changes in v2:
- Actually drop support for five panels acked by Doug Andersson
- Link to v1: 
https://lore.kernel.org/r/20240523-edp-panel-drop-v1-1-045d62511...@linaro.org

---
Dmitry Baryshkov (3):
  drm/panel-edp: add fat warning against adding new panel compatibles
  dt-bindings: display: panel-simple: drop several eDP panels
  drm/panel-edp: drop several legacy panels

 .../bindings/display/panel/panel-simple.yaml   |  10 --
 drivers/gpu/drm/panel/panel-edp.c  | 191 +++--
 2 files changed, 24 insertions(+), 177 deletions(-)
---
base-commit: 6dc544b66971c7f9909ff038b62149105272d26a
change-id: 20240523-edp-panel-drop-00aa239b3c6b

Best regards,
-- 
Dmitry Baryshkov 



[PATCH v2 1/3] drm/panel-edp: add fat warning against adding new panel compatibles

2024-05-28 Thread Dmitry Baryshkov
Add a fat warning against adding new panel compatibles to the panel-edp
driver. All new users of the eDP panels are supposed to use the generic
"edp-panel" compatible device on the AUX bus. The remaining compatibles
are either used by the existing DT or were used previously and are
retained for backwards compatibility.

Suggested-by: Doug Anderson 
Reviewed-by: Neil Armstrong 
Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/panel/panel-edp.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c 
b/drivers/gpu/drm/panel/panel-edp.c
index 6db277efcbb7..95b25ec67168 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -1776,7 +1776,23 @@ static const struct of_device_id platform_of_match[] = {
{
/* Must be first */
.compatible = "edp-panel",
-   }, {
+   },
+   /*
+* Do not add panels to the list below unless they cannot be handled by
+* the generic edp-panel compatible.
+*
+* The only two valid reasons are:
+* - because of the panel issues (e.g. broken EDID or broken
+*   identification),
+* - because the platform which uses the panel didn't wire up the AUX
+*   bus properly.
+*
+* In all other cases the platform should use the aux-bus and declare
+* the panel using the 'edp-panel' compatible as a device on the AUX
+* bus. The lack of the aux-bus support is not a valid case. Platforms
+* are urged to be converted to declaring panels in a proper way.
+*/
+   {
.compatible = "auo,b101ean01",
.data = _b101ean01,
}, {

-- 
2.39.2



Re: [PATCH] drm/nouveau: don't attempt to schedule hpd_work on headless cards

2024-05-28 Thread Ben Skeggs

On 29/5/24 07:52, Vasily Khoruzhick wrote:


If the card doesn't have display hardware, hpd_work and hpd_lock are
left uninitialized which causes BUG when attempting to schedule hpd_work
on runtime PM resume.


Hi,

Good catch, thank you for looking at this.  A couple of initial comments 
below:


Ben.



Fix it by adding headless flag to DRM and skip any hpd if it's set.

Fixes: ae1aadb1eb8d ("nouveau: don't fail driver load if no display hw 
present.")
Link: https://gitlab.freedesktop.org/drm/nouveau/-/issues/337
Signed-off-by: Vasily Khoruzhick 
---
  drivers/gpu/drm/nouveau/dispnv04/disp.c |  2 +-
  drivers/gpu/drm/nouveau/dispnv50/disp.c |  2 +-
  drivers/gpu/drm/nouveau/nouveau_connector.c |  3 +++
  drivers/gpu/drm/nouveau/nouveau_display.c   | 11 ++-
  drivers/gpu/drm/nouveau/nouveau_drv.h   |  1 +
  5 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c 
b/drivers/gpu/drm/nouveau/dispnv04/disp.c
index 13705c5f1497..4b7497a8755c 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
@@ -68,7 +68,7 @@ nv04_display_fini(struct drm_device *dev, bool runtime, bool 
suspend)
if (nv_two_heads(dev))
NVWriteCRTC(dev, 1, NV_PCRTC_INTR_EN_0, 0);
  
-	if (!runtime)

+   if (!runtime && !drm->headless)
cancel_work_sync(>hpd_work);
  
  	if (!suspend)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 88728a0b2c25..674dc567e179 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -2680,7 +2680,7 @@ nv50_display_fini(struct drm_device *dev, bool runtime, 
bool suspend)
nv50_mstm_fini(nouveau_encoder(encoder));
}
  
-	if (!runtime)

+   if (!runtime && !drm->headless)
cancel_work_sync(>hpd_work);
  }
  
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c

index 856b3ef5edb8..b315a2ef5b28 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1190,6 +1190,9 @@ nouveau_connector_hpd(struct nouveau_connector 
*nv_connector, u64 bits)
u32 mask = drm_connector_mask(_connector->base);
unsigned long flags;
  
+	if (drm->headless)

+   return;
+


You shouldn't need this change, the function can't be called if there's 
no display.




spin_lock_irqsave(>hpd_lock, flags);
if (!(drm->hpd_pending & mask)) {
nv_connector->hpd_pending |= bits;
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c 
b/drivers/gpu/drm/nouveau/nouveau_display.c
index aed5d5b51b43..1961ef665e97 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -450,6 +450,9 @@ nouveau_display_hpd_resume(struct drm_device *dev)
  {
struct nouveau_drm *drm = nouveau_drm(dev);
  
+	if (drm->headless)

+   return;
+
spin_lock_irq(>hpd_lock);
drm->hpd_pending = ~0;
spin_unlock_irq(>hpd_lock);
@@ -468,6 +471,11 @@ nouveau_display_hpd_work(struct work_struct *work)
int changed = 0;
struct drm_connector *first_changed_connector = NULL;
  
+	WARN_ON_ONCE(drm->headless);

+
+   if (drm->headless)
+   return;
+


Same here.



pm_runtime_get_sync(dev->dev);
  
  	spin_lock_irq(>hpd_lock);

@@ -635,7 +643,7 @@ nouveau_display_fini(struct drm_device *dev, bool suspend, 
bool runtime)
}
drm_connector_list_iter_end(_iter);
  
-	if (!runtime)

+   if (!runtime && !drm->headless)
cancel_work_sync(>hpd_work);
  
  	drm_kms_helper_poll_disable(dev);

@@ -729,6 +737,7 @@ nouveau_display_create(struct drm_device *dev)
/* no display hw */
if (ret == -ENODEV) {
ret = 0;
+   drm->headless = true;
goto disp_create_err;
}
  
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h

index e239c6bf4afa..25fca98a20bc 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -276,6 +276,7 @@ struct nouveau_drm {
/* modesetting */
struct nvbios vbios;
struct nouveau_display *display;
+   bool headless;
struct work_struct hpd_work;
spinlock_t hpd_lock;
u32 hpd_pending;


Re: [PATCH v5 2/6] drm/msm/dpu: adjust data width for widen bus case

2024-05-28 Thread Jessica Zhang




On 5/27/2024 7:21 AM, Jun Nie wrote:

data is valid for only half the active window if widebus
is enabled

Signed-off-by: Jun Nie 


Hi Jun,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 9 +
  1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 225c1c7768ff..f97221423249 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -168,6 +168,15 @@ static void dpu_hw_intf_setup_timing_engine(struct 
dpu_hw_intf *intf,
  
  	data_width = p->width;
  
+	/*

+* If widebus is enabled, data is valid for only half the active window
+* since the data rate is doubled in this mode. But for the compression
+* mode in DP case, the p->width is already adjusted in
+* drm_mode_to_intf_timing_params()
+*/
+   if (p->wide_bus_en && !dp_intf)
+   data_width = p->width >> 1;
+
hsync_data_start_x = hsync_start_x;
hsync_data_end_x =  hsync_start_x + data_width - 1;
  


--
2.34.1



[PATCH v2] drm/i915/guc: Enable w/a 16021333562 for DG2, MTL and ARL

2024-05-28 Thread John . C . Harrison
From: John Harrison 

Enable another workaround that is implemented inside the GuC.

v2: Use the correct Gen12 w/a id rather than the Xe version (review
feedback from Matthew R) also extend to include ARL.

Signed-off-by: John Harrison 
---
 drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h |  1 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c| 32 ---
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h 
b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
index 525587cfe1af9..37ff539a6963d 100644
--- a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
+++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
@@ -106,6 +106,7 @@ enum {
  */
 enum {
GUC_WORKAROUND_KLV_SERIALIZED_RA_MODE   = 
0x9001,
+   GUC_WORKAROUND_KLV_BLOCK_INTERRUPTS_WHEN_MGSR_BLOCKED   = 
0x9002,
 };
 
 #endif /* _ABI_GUC_KLVS_ABI_H */
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
index c606bb5e3b7b0..7995f059f30df 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
@@ -815,23 +815,23 @@ guc_capture_prep_lists(struct intel_guc *guc)
return PAGE_ALIGN(total_size);
 }
 
-/* Wa_14019159160 */
-static u32 guc_waklv_ra_mode(struct intel_guc *guc, u32 offset, u32 remain)
+static void guc_waklv_enable_simple(struct intel_guc *guc,
+   u32 klv_id, u32 *offset, u32 *remain)
 {
u32 size;
u32 klv_entry[] = {
/* 16:16 key/length */
-   FIELD_PREP(GUC_KLV_0_KEY, 
GUC_WORKAROUND_KLV_SERIALIZED_RA_MODE) |
+   FIELD_PREP(GUC_KLV_0_KEY, klv_id) |
FIELD_PREP(GUC_KLV_0_LEN, 0),
/* 0 dwords data */
};
 
size = sizeof(klv_entry);
-   GEM_BUG_ON(remain < size);
+   GEM_BUG_ON(*remain < size);
 
-   iosys_map_memcpy_to(>ads_map, offset, klv_entry, size);
-
-   return size;
+   iosys_map_memcpy_to(>ads_map, *offset, klv_entry, size);
+   *offset += size;
+   *remain -= size;
 }
 
 static void guc_waklv_init(struct intel_guc *guc)
@@ -850,11 +850,19 @@ static void guc_waklv_init(struct intel_guc *guc)
remain = guc_ads_waklv_size(guc);
 
/* Wa_14019159160 */
-   if (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71))) {
-   size = guc_waklv_ra_mode(guc, offset, remain);
-   offset += size;
-   remain -= size;
-   }
+   if (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71)))
+   guc_waklv_enable_simple(guc,
+   GUC_WORKAROUND_KLV_SERIALIZED_RA_MODE,
+   , );
+
+   /* Wa_16021333562 */
+   if ((GUC_FIRMWARE_VER(guc) >= MAKE_GUC_VER(70, 21, 1)) &&
+   (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 74)) ||
+IS_MEDIA_GT_IP_RANGE(gt, IP_VER(13, 0), IP_VER(13, 0)) ||
+IS_DG2(gt->i915)))
+   guc_waklv_enable_simple(guc,
+   
GUC_WORKAROUND_KLV_BLOCK_INTERRUPTS_WHEN_MGSR_BLOCKED,
+   , );
 
size = guc_ads_waklv_size(guc) - remain;
if (!size)
-- 
2.43.2



Re: [PATCH v5 3/6] drm/msm/dpu: enable compression bit in cfg2 for DSC

2024-05-28 Thread Jessica Zhang




On 5/27/2024 7:21 AM, Jun Nie wrote:

Enable compression bit in cfg2 register for DSC in the DSI case

Signed-off-by: Jun Nie 
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 4 
  1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index f97221423249..34bfcfba3df2 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -177,6 +177,10 @@ static void dpu_hw_intf_setup_timing_engine(struct 
dpu_hw_intf *intf,
if (p->wide_bus_en && !dp_intf)
data_width = p->width >> 1;
  
+	/* TODO: handle DSC+DP case, we only handle DSC+DSI case so far */

+   if (p->compression_en && !dp_intf)
+   intf_cfg2 |= INTF_CFG2_DCE_DATA_COMPRESS;


Hi Jun,

The DSC/DCE enablement registers were only moved to INTF in DPU 7.x and 
later.


We should probably add some MDSS version check similar to what command 
mode INTF does here [1]


Thanks,

Jessica Zhang


+
hsync_data_start_x = hsync_start_x;
hsync_data_end_x =  hsync_start_x + data_width - 1;
  


--
2.34.1



Re: [PATCH] drm/i915/guc: Enable w/a 14019882105 for DG2 and MTL

2024-05-28 Thread John Harrison

On 5/28/2024 13:21, Matt Roper wrote:

On Fri, May 24, 2024 at 06:41:20PM -0700, john.c.harri...@intel.com wrote:

From: John Harrison 

Enable another workaround that is implemented inside the GuC.

Signed-off-by: John Harrison 
---
  drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h |  1 +
  drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c| 32 ---
  2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h 
b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
index 525587cfe1af9..37ff539a6963d 100644
--- a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
+++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
@@ -106,6 +106,7 @@ enum {
   */
  enum {
GUC_WORKAROUND_KLV_SERIALIZED_RA_MODE   = 
0x9001,
+   GUC_WORKAROUND_KLV_BLOCK_INTERRUPTS_WHEN_MGSR_BLOCKED   = 
0x9002,
  };
  
  #endif /* _ABI_GUC_KLVS_ABI_H */

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
index c606bb5e3b7b0..6c382785bc60b 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
@@ -815,23 +815,23 @@ guc_capture_prep_lists(struct intel_guc *guc)
return PAGE_ALIGN(total_size);
  }
  
-/* Wa_14019159160 */

-static u32 guc_waklv_ra_mode(struct intel_guc *guc, u32 offset, u32 remain)
+static void guc_waklv_enable_simple(struct intel_guc *guc,
+   u32 klv_id, u32 *offset, u32 *remain)
  {
u32 size;
u32 klv_entry[] = {
/* 16:16 key/length */
-   FIELD_PREP(GUC_KLV_0_KEY, 
GUC_WORKAROUND_KLV_SERIALIZED_RA_MODE) |
+   FIELD_PREP(GUC_KLV_0_KEY, klv_id) |
FIELD_PREP(GUC_KLV_0_LEN, 0),
/* 0 dwords data */
};
  
  	size = sizeof(klv_entry);

-   GEM_BUG_ON(remain < size);
+   GEM_BUG_ON(*remain < size);
  
-	iosys_map_memcpy_to(>ads_map, offset, klv_entry, size);

-
-   return size;
+   iosys_map_memcpy_to(>ads_map, *offset, klv_entry, size);
+   *offset += size;
+   *remain -= size;
  }
  
  static void guc_waklv_init(struct intel_guc *guc)

@@ -850,11 +850,19 @@ static void guc_waklv_init(struct intel_guc *guc)
remain = guc_ads_waklv_size(guc);
  
  	/* Wa_14019159160 */

-   if (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71))) {
-   size = guc_waklv_ra_mode(guc, offset, remain);
-   offset += size;
-   remain -= size;
-   }
+   if (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71)))
+   guc_waklv_enable_simple(guc,
+   GUC_WORKAROUND_KLV_SERIALIZED_RA_MODE,
+   , );
+
+   /* Wa_14019882105 */

Is this the right number?  When I look up Wa_14019882105 in the
workaround database, it only lists it as being relevant to A steppings
of G:20.04.  I don't see entries for 12.70/12.71.  Did it go by a
different lineage number on the older platforms?
Argh. Copied the wrong number. 2105 is the Xe version, the Gen12 version 
is 16021333562. I think it is two separate actual issues, hence two 
different w/a numbers, but the w/a itself is the same for both. Hmm, 
looks ike 3562 should also be enabled for 12.74. Not sure how I missed 
that, unless that is a recent update?




Also, I notice the Wa_14019159160 we had just above this workaround is
missing handling for graphics version 12.74.
12.74 is ARL? I think extending that is on my todo list as well. I have 
just been leaving updates to 160 until later because that one is 
horrific. It needs extending to DG2 as well but a whole bunch of tests 
start to fail when it is enabled because they need to be re-written to 
cope with the broken hardware.


John.




Matt


+   if ((GUC_FIRMWARE_VER(guc) >= MAKE_GUC_VER(70, 21, 1)) &&
+   (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71)) ||
+IS_MEDIA_GT_IP_RANGE(gt, IP_VER(13, 0), IP_VER(13, 0)) ||
+IS_DG2(gt->i915)))
+   guc_waklv_enable_simple(guc,
+   
GUC_WORKAROUND_KLV_BLOCK_INTERRUPTS_WHEN_MGSR_BLOCKED,
+   , );
  
  	size = guc_ads_waklv_size(guc) - remain;

if (!size)
--
2.43.2





Re: [PATCH v5 6/6] drm/msm/dsi: add a comment to explain pkt_per_line encoding

2024-05-28 Thread Jessica Zhang




On 5/27/2024 7:21 AM, Jun Nie wrote:

From: Jonathan Marek 

Make it clear why the pkt_per_line value is being "divided by 2".

Signed-off-by: Jonathan Marek 
Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Jun Nie 


Hi Jun,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 4 
  1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 7252d36687e6..4768cff08381 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -885,7 +885,11 @@ static void dsi_update_dsc_timing(struct msm_dsi_host 
*msm_host, bool is_cmd_mod
/* DSI_VIDEO_COMPRESSION_MODE & DSI_COMMAND_COMPRESSION_MODE
 * registers have similar offsets, so for below common code use
 * DSI_VIDEO_COMPRESSION_MODE_ for setting bits
+*
+* pkt_per_line is log2 encoded, >>1 works for supported values (1,2,4)
 */
+   if (pkt_per_line > 4)
+   drm_warn_once(msm_host->dev, "pkt_per_line too big");
reg |= DSI_VIDEO_COMPRESSION_MODE_CTRL_PKT_PER_LINE(pkt_per_line >> 1);
reg |= DSI_VIDEO_COMPRESSION_MODE_CTRL_EOL_BYTE_NUM(eol_byte_num);
reg |= DSI_VIDEO_COMPRESSION_MODE_CTRL_EN;

--
2.34.1



Re: [PATCH v5 5/6] drm/msm/dsi: set VIDEO_COMPRESSION_MODE_CTRL_WC

2024-05-28 Thread Jessica Zhang




On 5/27/2024 7:21 AM, Jun Nie wrote:

From: Jonathan Marek 

Video mode DSC won't work if this field is not set correctly. Set it to fix
video mode DSC (for slice_per_pkt==1 cases at least).

Fixes: 08802f515c3c ("drm/msm/dsi: Add support for DSC configuration")
Signed-off-by: Jonathan Marek 
Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Jun Nie 


Hi Jun,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 47f5858334f6..7252d36687e6 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -857,6 +857,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host 
*msm_host, bool is_cmd_mod
u32 slice_per_intf, total_bytes_per_intf;
u32 pkt_per_line;
u32 eol_byte_num;
+   u32 bytes_per_pkt;
  
  	/* first calculate dsc parameters and then program

 * compress mode registers
@@ -864,6 +865,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host 
*msm_host, bool is_cmd_mod
slice_per_intf = msm_dsc_get_slices_per_intf(dsc, hdisplay);
  
  	total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf;

+   bytes_per_pkt = dsc->slice_chunk_size; /* * slice_per_pkt; */
  
  	eol_byte_num = total_bytes_per_intf % 3;
  
@@ -901,6 +903,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod

dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL, 
reg_ctrl);
dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2, 
reg_ctrl2);
} else {
+   reg |= DSI_VIDEO_COMPRESSION_MODE_CTRL_WC(bytes_per_pkt);
dsi_write(msm_host, REG_DSI_VIDEO_COMPRESSION_MODE_CTRL, reg);
}
  }

--
2.34.1



[PATCH] drm/nouveau: don't attempt to schedule hpd_work on headless cards

2024-05-28 Thread Vasily Khoruzhick
If the card doesn't have display hardware, hpd_work and hpd_lock are
left uninitialized which causes BUG when attempting to schedule hpd_work
on runtime PM resume.

Fix it by adding headless flag to DRM and skip any hpd if it's set.

Fixes: ae1aadb1eb8d ("nouveau: don't fail driver load if no display hw 
present.")
Link: https://gitlab.freedesktop.org/drm/nouveau/-/issues/337
Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/nouveau/dispnv04/disp.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c |  2 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c |  3 +++
 drivers/gpu/drm/nouveau/nouveau_display.c   | 11 ++-
 drivers/gpu/drm/nouveau/nouveau_drv.h   |  1 +
 5 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c 
b/drivers/gpu/drm/nouveau/dispnv04/disp.c
index 13705c5f1497..4b7497a8755c 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
@@ -68,7 +68,7 @@ nv04_display_fini(struct drm_device *dev, bool runtime, bool 
suspend)
if (nv_two_heads(dev))
NVWriteCRTC(dev, 1, NV_PCRTC_INTR_EN_0, 0);
 
-   if (!runtime)
+   if (!runtime && !drm->headless)
cancel_work_sync(>hpd_work);
 
if (!suspend)
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 88728a0b2c25..674dc567e179 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -2680,7 +2680,7 @@ nv50_display_fini(struct drm_device *dev, bool runtime, 
bool suspend)
nv50_mstm_fini(nouveau_encoder(encoder));
}
 
-   if (!runtime)
+   if (!runtime && !drm->headless)
cancel_work_sync(>hpd_work);
 }
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c 
b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 856b3ef5edb8..b315a2ef5b28 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1190,6 +1190,9 @@ nouveau_connector_hpd(struct nouveau_connector 
*nv_connector, u64 bits)
u32 mask = drm_connector_mask(_connector->base);
unsigned long flags;
 
+   if (drm->headless)
+   return;
+
spin_lock_irqsave(>hpd_lock, flags);
if (!(drm->hpd_pending & mask)) {
nv_connector->hpd_pending |= bits;
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c 
b/drivers/gpu/drm/nouveau/nouveau_display.c
index aed5d5b51b43..1961ef665e97 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -450,6 +450,9 @@ nouveau_display_hpd_resume(struct drm_device *dev)
 {
struct nouveau_drm *drm = nouveau_drm(dev);
 
+   if (drm->headless)
+   return;
+
spin_lock_irq(>hpd_lock);
drm->hpd_pending = ~0;
spin_unlock_irq(>hpd_lock);
@@ -468,6 +471,11 @@ nouveau_display_hpd_work(struct work_struct *work)
int changed = 0;
struct drm_connector *first_changed_connector = NULL;
 
+   WARN_ON_ONCE(drm->headless);
+
+   if (drm->headless)
+   return;
+
pm_runtime_get_sync(dev->dev);
 
spin_lock_irq(>hpd_lock);
@@ -635,7 +643,7 @@ nouveau_display_fini(struct drm_device *dev, bool suspend, 
bool runtime)
}
drm_connector_list_iter_end(_iter);
 
-   if (!runtime)
+   if (!runtime && !drm->headless)
cancel_work_sync(>hpd_work);
 
drm_kms_helper_poll_disable(dev);
@@ -729,6 +737,7 @@ nouveau_display_create(struct drm_device *dev)
/* no display hw */
if (ret == -ENODEV) {
ret = 0;
+   drm->headless = true;
goto disp_create_err;
}
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h 
b/drivers/gpu/drm/nouveau/nouveau_drv.h
index e239c6bf4afa..25fca98a20bc 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -276,6 +276,7 @@ struct nouveau_drm {
/* modesetting */
struct nvbios vbios;
struct nouveau_display *display;
+   bool headless;
struct work_struct hpd_work;
spinlock_t hpd_lock;
u32 hpd_pending;
-- 
2.45.1



Re: [PATCH 4/9] drm/i915: Introduce fb->min_alignment

2024-05-28 Thread Imre Deak
On Tue, May 28, 2024 at 10:38:06PM +0300, Ville Syrjälä wrote:
> On Tue, May 28, 2024 at 02:27:52PM +0300, Imre Deak wrote:
> > On Mon, May 13, 2024 at 08:59:37PM +0300, Ville Syrjala wrote:
> > > From: Ville Syrjälä 
> > > 
> > > Different planes could have different alignment requirements
> > > even for the same format/modifier. Collect the alignment
> > > requirements across all planes capable of scanning out the
> > > fb such that the alignment used when pinning the normal ggtt
> > > view is satisfactory to all those planes.
> > > 
> > > When pinning per-plane views we only have to satisfy the
> > > alignment requirements of the specific plane.
> > > 
> > > Signed-off-by: Ville Syrjälä 
> > > ---
> > >  .../drm/i915/display/intel_display_types.h|  2 ++
> > >  drivers/gpu/drm/i915/display/intel_fb.c   | 23 
> > >  drivers/gpu/drm/i915/display/intel_fb_pin.c   | 27 +--
> > >  drivers/gpu/drm/i915/display/intel_fbdev.c| 18 +
> > >  4 files changed, 51 insertions(+), 19 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> > > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > > index 40d6e5f4c350..58bb65832adf 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > > @@ -145,6 +145,8 @@ struct intel_framebuffer {
> > >   };
> > >  
> > >   struct i915_address_space *dpt_vm;
> > > +
> > > + unsigned int min_alignment;
> > >  };
> > >  
> > >  enum intel_hotplug_state {
> > > diff --git a/drivers/gpu/drm/i915/display/intel_fb.c 
> > > b/drivers/gpu/drm/i915/display/intel_fb.c
> > > index 3f3a9cd534f4..c5bae05cbbc3 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_fb.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> > > @@ -10,6 +10,7 @@
> > >  #include 
> > >  
> > >  #include "i915_drv.h"
> > > +#include "intel_atomic_plane.h"
> > >  #include "intel_display.h"
> > >  #include "intel_display_types.h"
> > >  #include "intel_dpt.h"
> > > @@ -1616,6 +1617,26 @@ bool intel_fb_supports_90_270_rotation(const 
> > > struct intel_framebuffer *fb)
> > >  fb->base.modifier == I915_FORMAT_MOD_Yf_TILED;
> > >  }
> > >  
> > > +static unsigned int intel_fb_min_alignment(const struct drm_framebuffer 
> > > *fb)
> > > +{
> > > + struct drm_i915_private *i915 = to_i915(fb->dev);
> > > + struct intel_plane *plane;
> > > + unsigned int min_alignment = 0;
> > > +
> > > + for_each_intel_plane(>drm, plane) {
> > > + if (!drm_plane_has_format(>base, fb->format->format, 
> > > fb->modifier))
> > > + continue;
> > > +
> > > + if (intel_plane_needs_physical(plane))
> > > + continue;
> > > +
> > > + min_alignment = max(min_alignment,
> > > + plane->min_alignment(plane, fb, 0));
> > > + }
> > > +
> > > + return min_alignment;
> > > +}
> > > +
> > >  int intel_fill_fb_info(struct drm_i915_private *i915, struct 
> > > intel_framebuffer *fb)
> > >  {
> > >   struct drm_i915_gem_object *obj = intel_fb_obj(>base);
> > > @@ -1698,6 +1719,8 @@ int intel_fill_fb_info(struct drm_i915_private 
> > > *i915, struct intel_framebuffer *
> > >   return -EINVAL;
> > >   }
> > >  
> > > + fb->min_alignment = intel_fb_min_alignment(>base);
> > > +
> > >   return 0;
> > >  }
> > >  
> > > diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.c 
> > > b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > > index 9b0f1ea41b70..1ae02de906f5 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > > @@ -230,13 +230,36 @@ void intel_fb_unpin_vma(struct i915_vma *vma, 
> > > unsigned long flags)
> > >   i915_vma_put(vma);
> > >  }
> > >  
> > > +static bool gtt_view_is_per_plane(const struct intel_plane_state 
> > > *plane_state)
> > > +{
> > > + const struct intel_framebuffer *fb = 
> > > to_intel_framebuffer(plane_state->hw.fb);
> > > +
> > > + if (plane_state->view.gtt.type == I915_GTT_VIEW_REMAPPED &&
> > > + intel_fb_needs_pot_stride_remap(fb))
> > > + return false;
> > 
> > The above view is created only once for the FB, I suppose this is how
> > you differentiate it from views created each time due to a stride
> > limit (based on intel_plane_needs_remap()).
> > 
> > > +
> > > + return plane_state->view.gtt.type != I915_GTT_VIEW_NORMAL;
> > 
> > So the rotated and remapped views created for a stride limit are
> > per-plane based on the above. There is also a rotated view created only
> > once for the FB, is it intentional to regard this kind of view as
> > per-plane as well?
> 
> No. Forgot those exist. I guess I should just remove this per-plane
> alignment logic for now. Need to think of a proper way to add it back,
> or just quietly bury the whole idea.

Another variation is that intel_fb_pin_to_ggtt() etc. tries to bind the
vma in max -> min alignment order considering all the plane 

Re: [linux-next:master] BUILD REGRESSION 6dc544b66971c7f9909ff038b62149105272d26a

2024-05-28 Thread David Sterba
On Wed, May 29, 2024 at 02:19:47AM +0800, kernel test robot wrote:
> tree/branch: 
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> branch HEAD: 6dc544b66971c7f9909ff038b62149105272d26a  Add linux-next 
> specific files for 20240528
> 
> Error/Warning reports:
> 
> https://lore.kernel.org/oe-kbuild-all/202405282036.maedo54q-...@intel.com
> https://lore.kernel.org/oe-kbuild-all/202405282148.jaf0flhu-...@intel.com
> https://lore.kernel.org/oe-kbuild-all/202405282308.uezt6hqc-...@intel.com
> 
> Error/Warning: (recently discovered and may have been fixed)
> 
> drivers/dma-buf/udmabuf.c:45:(.text+0x140): undefined reference to 
> `vmf_insert_pfn'
> fs/btrfs/fiemap.c:822:26: warning: 'last_extent_end' may be used 
> uninitialized [-Wmaybe-uninitialized]

The report says it's gcc 13.2, that one I use (and expect others as well
as it's a recent one) and we also have -Wmaybe-uninitialized enabled in
fs/btrfs/ to catch such warnings. Yet this is reported on mips64, is
there something special about that compiler+architecture?

The warning is IMO a false positive, the maybe-uninitialized variable is
passed as pointer but initialized on success and never used on failure.
We can safely silence the warning by initializing the variable to 0 but
this may be pointing to a problem with mips64+gcc namely because other
compiler+host combinations do not warn abou that.


Re: [RFC PATCH 7/8] rust: add firmware abstractions

2024-05-28 Thread Zhi Wang
On 28/05/2024 17.18, Danilo Krummrich wrote:
> External email: Use caution opening links or attachments
> 
> 
> On Tue, May 28, 2024 at 08:40:20AM +, Zhi Wang wrote:
>> On 27/05/2024 22.18, Danilo Krummrich wrote:
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> On Tue, May 21, 2024 at 08:32:31AM +0300, Zhi Wang wrote:
 On Mon, 20 May 2024 19:24:19 +0200
 Danilo Krummrich  wrote:

> Add an abstraction around the kernels firmware API to request firmware
> images. The abstraction provides functions to access the firmware
> buffer and / or copy it to a new buffer allocated with a given
> allocator backend.
>

 Was playing with firmware extractions based on this patch.
 Unfortunately I ended up with a lot of pointer operations, unsafe
 statements.

 As we know many vendors have a C headers for the definitions of the
 firwmare content, the driver extract the data by applying a struct
 pointer on it.

 But in rust, I feel it would nice that we can also have a common
 firmware extractor for drivers, that can wrap the pointer operations,
 take a list of the firmware struct members that converted from C headers
 as the input, offer the driver some common ABI methods to query them.
 Maybe that would ease the pain a lot.
>>>
>>> So, you mean some abstraction that takes a list of types, offsets in the
>>> firmware and a reference to the firmware itself and provides references to 
>>> the
>>> corresponding objects?
>>>
>>> I agree it might be helpful to have some common infrastructure for this, 
>>> but the
>>> operations on it would still be unsafe, since ultimately it involves
>>> dereferencing pointers.
>>>
>>
>> I think the goal is to 1) concentrate the "unsafe" operations in a
>> abstraction so the driver doesn't have to write explanation of unsafe
>> operations here and there, improve the readability of the driver that
>> interacts with vendor-firmware buffer. 2) ease the driver maintenance
>> burden.
> 
> With a generic abstraction, as in 1), at lest some of the abstraction's
> functions would be unsafe themselves, since they have to rely on the layout
> (or offset) passed by the driver being correct. What if I pass a wrong layout 
> /
> offset for a structure that contains a pointer? This might still result in an
> invalid pointer dereference. Am I missing something?
> 
>>
>> Some solutions I saw in different projects written in rust for
>> de-referencing a per-defined struct:
>>
>> 1) Take the vendor firmware buffer as a whole, invent methods like
>> read/write with offset for operating the buffer.
>>
>> In this scheme, the driver is responsible for taking care of each data
>> member in a vendor firmware struct and also its valid offset. The
>> abstraction only covers the boundary of the whole firmware buffer.
>>
>> The cons is the readability of the operation of the vendor firmware
>> buffer in the driver is not good comparing with C code.
>>
>> Hate to think a lot of xxx = vendor_firmware_struct.read(offset); //
>> reading item A in the code.
>>
>> 2) Define the firmware struct in rust (might need to find a better way
>> to handle "union" in the definition of the vendor firmware struct). Use
>> macros to generate methods of accessing each data member for the vendor
>> firmware struct.
>>
>> Then the code in the driver will be like xxx =
>> vendor_firmware_struct.item_a(); in the driver.
>>
>> In this scheme, the abstraction and the generated methods covers the
>> boundary check. The "unsafe" statement can stay in the generated
>> struct-access methods.
>>
>> This might even be implemented as a more generic rust feature in the kernel.
> 
> This sounds more like a driver specific abstraction to me, which, as you 
> write,
> we can probably come up with some macros that help implementing it.
> 
> But again, what if the offsets are within the boundary, but still at a wrong
> offset? What if the data obtained from a wrong offset leads to other safety
> implications when further processing them? I think no generic abstraction can
> ever cover the safety parts of this (entirely). I think there are always 
> semanic
> parts to this the driver has to cover.
> 

I was thinking of a proc_macro that takes a vender-firmware struct 
definition. As it can get the type and the name of each member, then it 
can generate methods like xxx::member_a() that returns the value from 
the "unsafe {*(type *)(pointer + offset)}". Thus, the unsafe stuff stays 
in the generated methods.

For offset, I was hoping the macro can automatically calculate it based 
on the member offset (the vendor-firmware definition) when generating 
xxx::member_x(). (Maybe it can also take alignment into account)

As the return value has a rust type, rust should catch it if the caller 
wants to do something crazy there.

> Generally, I think we should aim for some generalization, but I think we 
> should
> not expect it to cover all the 

Re: [PATCH v5 1/6] drm/msm/dpu: fix video mode DSC for DSI

2024-05-28 Thread Jessica Zhang




On 5/27/2024 7:21 AM, Jun Nie wrote:

From: Jonathan Marek 

Add width change in DPU timing for DSC compression case to work with
DSI video mode.


Hi Jun,

LGTM

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



Signed-off-by: Jonathan Marek 
Signed-off-by: Jun Nie 
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c  |  2 +-
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |  8 
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 18 ++
  3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 119f3ea50a7c..48cef6e79c70 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -564,7 +564,7 @@ bool dpu_encoder_use_dsc_merge(struct drm_encoder *drm_enc)
return (num_dsc > 0) && (num_dsc > intf_count);
  }
  
-static struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc)

+struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc)
  {
struct msm_drm_private *priv = drm_enc->dev->dev_private;
struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
index 002e89cc1705..2167c46c1a45 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
@@ -334,6 +334,14 @@ static inline enum dpu_3d_blend_mode 
dpu_encoder_helper_get_3d_blend_mode(
   */
  unsigned int dpu_encoder_helper_get_dsc(struct dpu_encoder_phys *phys_enc);
  
+/**

+ * dpu_encoder_get_dsc_config - get DSC config for the DPU encoder
+ *   This helper function is used by physical encoder to get DSC config
+ *   used for this encoder.
+ * @drm_enc: Pointer to encoder structure
+ */
+struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc);
+
  /**
   * dpu_encoder_get_drm_fmt - return DRM fourcc format
   * @phys_enc: Pointer to physical encoder structure
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
index ef69c2f408c3..925ec6ada0e1 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
@@ -11,6 +11,7 @@
  #include "dpu_trace.h"
  #include "disp/msm_disp_snapshot.h"
  
+#include 

  #include 
  
  #define DPU_DEBUG_VIDENC(e, fmt, ...) DPU_DEBUG("enc%d intf%d " fmt, \

@@ -115,6 +116,23 @@ static void drm_mode_to_intf_timing_params(
timing->h_front_porch = timing->h_front_porch >> 1;
timing->hsync_pulse_width = timing->hsync_pulse_width >> 1;
}
+
+   /*
+* for DSI, if compression is enabled, then divide the horizonal active
+* timing parameters by compression ratio. bits of 3 components(R/G/B)
+* is compressed into bits of 1 pixel.
+*/
+   if (phys_enc->hw_intf->cap->type != INTF_DP && timing->compression_en) {
+   struct drm_dsc_config *dsc =
+  dpu_encoder_get_dsc_config(phys_enc->parent);
+   /*
+* TODO: replace drm_dsc_get_bpp_int with logic to handle
+* fractional part if there is fraction
+*/
+   timing->width = timing->width * drm_dsc_get_bpp_int(dsc) /
+   (dsc->bits_per_component * 3);
+   timing->xres = timing->width;
+   }
  }
  
  static u32 get_horizontal_total(const struct dpu_hw_intf_timing_params *timing)


--
2.34.1



Re: [PATCH v2 2/7] soc: qcom: smem: Add a feature code getter

2024-05-28 Thread Bjorn Andersson
On Wed, Apr 17, 2024 at 10:02:54PM GMT, Konrad Dybcio wrote:
[..]
> diff --git a/include/linux/soc/qcom/socinfo.h 
> b/include/linux/soc/qcom/socinfo.h
> index 10e0a4c287f4..52439f48428f 100644
> --- a/include/linux/soc/qcom/socinfo.h
> +++ b/include/linux/soc/qcom/socinfo.h
> @@ -3,6 +3,8 @@
>  #ifndef __QCOM_SOCINFO_H__
>  #define __QCOM_SOCINFO_H__
>  
> +#include 
> +
>  /*
>   * SMEM item id, used to acquire handles to respective
>   * SMEM region.
> @@ -82,4 +84,28 @@ struct socinfo {
>   __le32 boot_core;
>  };
>  
> +/* Internal feature codes */
> +enum qcom_socinfo_feature_code {
> + /* External feature codes */
> + SOCINFO_FC_UNKNOWN = 0x0,
> + SOCINFO_FC_AA,
> + SOCINFO_FC_AB,
> + SOCINFO_FC_AC,
> + SOCINFO_FC_AD,
> + SOCINFO_FC_AE,
> + SOCINFO_FC_AF,
> + SOCINFO_FC_AG,
> + SOCINFO_FC_AH,
> +};
> +
> +/* Internal feature codes */
> +/* Valid values: 0 <= n <= 0xf */
> +#define SOCINFO_FC_Yn(n) (0xf1 + n)

Please wrap that 'n' in some () here and below...

> +#define SOCINFO_FC_INT_MAX   SOCINFO_FC_Yn(0x10)

"MAX" sounds inclusive, but the value is exclusive.

Regards,
Bjorn

> +
> +/* Product codes */
> +#define SOCINFO_PC_UNKNOWN   0
> +#define SOCINFO_PCn(n)   (n + 1)
> +#define SOCINFO_PC_RESERVE   (BIT(31) - 1)
> +
>  #endif
> 
> -- 
> 2.44.0
> 


[PATCH v2] drm/client: Detect when ACPI lid is closed during initialization

2024-05-28 Thread Mario Limonciello
If the lid on a laptop is closed when eDP connectors are populated
then it remains enabled when the initial framebuffer configuration
is built.

When creating the initial framebuffer configuration detect the ACPI
lid status and if it's closed disable any eDP connectors.

Reported-by: Chris Bainbridge 
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3349
Signed-off-by: Mario Limonciello 
---
Cc: hughsi...@gmail.com
v1->v2:
 * Match LVDS as well
---
 drivers/gpu/drm/drm_client_modeset.c | 30 
 1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index 31af5cf37a09..0b0411086e76 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -8,6 +8,7 @@
  */
 
 #include "drm/drm_modeset_lock.h"
+#include 
 #include 
 #include 
 #include 
@@ -257,6 +258,34 @@ static void drm_client_connectors_enabled(struct 
drm_connector **connectors,
enabled[i] = drm_connector_enabled(connectors[i], false);
 }
 
+static void drm_client_match_edp_lid(struct drm_device *dev,
+struct drm_connector **connectors,
+unsigned int connector_count,
+bool *enabled)
+{
+   int i;
+
+   for (i = 0; i < connector_count; i++) {
+   struct drm_connector *connector = connectors[i];
+
+   switch (connector->connector_type) {
+   case DRM_MODE_CONNECTOR_LVDS:
+   case DRM_MODE_CONNECTOR_eDP:
+   if (!enabled[i])
+   continue;
+   break;
+   default:
+   continue;
+   }
+
+   if (!acpi_lid_open()) {
+   drm_dbg_kms(dev, "[CONNECTOR:%d:%s] lid is closed, 
disabling\n",
+   connector->base.id, connector->name);
+   enabled[i] = false;
+   }
+   }
+}
+
 static bool drm_client_target_cloned(struct drm_device *dev,
 struct drm_connector **connectors,
 unsigned int connector_count,
@@ -844,6 +873,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, 
unsigned int width,
memset(crtcs, 0, connector_count * sizeof(*crtcs));
memset(offsets, 0, connector_count * sizeof(*offsets));
 
+   drm_client_match_edp_lid(dev, connectors, connector_count, 
enabled);
if (!drm_client_target_cloned(dev, connectors, connector_count, 
modes,
  offsets, enabled, width, height) 
&&
!drm_client_target_preferred(dev, connectors, 
connector_count, modes,
-- 
2.43.0



Re: (subset) [PATCH 2/2] drm/panel-edp: Add more panels with conservative timings

2024-05-28 Thread Douglas Anderson


On Mon, 27 May 2024 17:54:50 +0800, Pin-yen Lin wrote:
> Same as commit 7c8690d8fc80 ("drm/panel-edp: Add some panels with
> conservative timings"), the 3 panels added in this patch are used by
> Mediatek MT8173 Chromebooks and they used to work with the downstream
> v4.19 kernel without any specified delay.
> 
> These panel IDs were found from in-field reports, but their datahseets
> are not available. For BOE 0x0623 and SHP 0x153a, their product names
> are retrieved from the EDIDs. The EDID of AUO 0x1999 does not contain
> such information, so list as "Unknown" in this patch.
> 
> [...]

Applied, thanks!

[2/2] drm/panel-edp: Add more panels with conservative timings
  commit: 336dca397dcefc5d7436be1fee3c814ed6512996

Best regards,
-- 
Douglas Anderson 



Re: (subset) [PATCH 1/2] drm/panel-edp: Add support for several panels

2024-05-28 Thread Douglas Anderson


On Mon, 27 May 2024 17:54:49 +0800, Pin-yen Lin wrote:
> Add support for the following models:
> AUO B140HTN02.0
> BOE NT116WHM-N21 V4.1
> BOE NT116WHM-N21
> 
> 

Applied, thanks!

[1/2] drm/panel-edp: Add support for several panels
  commit: e4f9fd9edbc22faceb4c9c57242440bb9e17924b

Best regards,
-- 
Douglas Anderson 



Re: [PATCH 2/2] drm/panel-edp: Add more panels with conservative timings

2024-05-28 Thread Doug Anderson
Hi,

On Mon, May 27, 2024 at 2:56 AM Pin-yen Lin  wrote:
>
> Same as commit 7c8690d8fc80 ("drm/panel-edp: Add some panels with
> conservative timings"), the 3 panels added in this patch are used by
> Mediatek MT8173 Chromebooks and they used to work with the downstream
> v4.19 kernel without any specified delay.
>
> These panel IDs were found from in-field reports, but their datahseets
> are not available. For BOE 0x0623 and SHP 0x153a, their product names
> are retrieved from the EDIDs. The EDID of AUO 0x1999 does not contain
> such information, so list as "Unknown" in this patch.
>
> Update these entries with less-conservative timings from other panels of
> the same vendor.
>
> Signed-off-by: Pin-yen Lin 
>
> ---
>
>  drivers/gpu/drm/panel/panel-edp.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Douglas Anderson 

...and as usual with small updates to this table I've pushed it to
drm-misc-next without a big wait.


Re: [PATCH 1/2] drm/panel-edp: Add support for several panels

2024-05-28 Thread Doug Anderson
Hi,

On Mon, May 27, 2024 at 2:56 AM Pin-yen Lin  wrote:
>
> Add support for the following models:
> AUO B140HTN02.0
> BOE NT116WHM-N21 V4.1
> BOE NT116WHM-N21
>
> Signed-off-by: Pin-yen Lin 
> ---
>
>  drivers/gpu/drm/panel/panel-edp.c | 3 +++
>  1 file changed, 3 insertions(+)

Ideally the subject would be slightly less generic, but I guess it's fine.

Reviewed-by: Douglas Anderson 

...and as usual with small updates to this table I've pushed it to
drm-misc-next without a big wait.


[drm-misc:drm-misc-next 10/29] drm_connector_test.c:undefined reference to `drm_hdmi_compute_mode_clock'

2024-05-28 Thread kernel test robot
tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head:   c7ce956bb6d0f32ab921b6ffba1a6a834df96f21
commit: abb6f74973e20956d42e8227dde6fb4e92502c14 [10/29] drm/tests: Add HDMI 
TDMS character rate tests
config: arc-randconfig-002-20240529 
(https://download.01.org/0day-ci/archive/20240529/202405290438.toyhxmin-...@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240529/202405290438.toyhxmin-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202405290438.toyhxmin-...@intel.com/

All errors (new ones prefixed by >>):

   arc-elf-ld: drivers/gpu/drm/tests/drm_connector_test.o: in function 
`drm_test_connector_hdmi_compute_mode_clock_yuv422_12_bpc':
>> drm_connector_test.c:(.text+0x140): undefined reference to 
>> `drm_hdmi_compute_mode_clock'
>> arc-elf-ld: drm_connector_test.c:(.text+0x140): undefined reference to 
>> `drm_hdmi_compute_mode_clock'
   arc-elf-ld: drivers/gpu/drm/tests/drm_connector_test.o: in function 
`drm_test_connector_hdmi_compute_mode_clock_yuv422_10_bpc':
   drm_connector_test.c:(.text+0x288): undefined reference to 
`drm_hdmi_compute_mode_clock'
   arc-elf-ld: drm_connector_test.c:(.text+0x288): undefined reference to 
`drm_hdmi_compute_mode_clock'
   arc-elf-ld: drivers/gpu/drm/tests/drm_connector_test.o: in function 
`drm_test_connector_hdmi_compute_mode_clock_yuv422_8_bpc':
   drm_connector_test.c:(.text+0x3d0): undefined reference to 
`drm_hdmi_compute_mode_clock'
   arc-elf-ld: 
drivers/gpu/drm/tests/drm_connector_test.o:drm_connector_test.c:(.text+0x3d0): 
more undefined references to `drm_hdmi_compute_mode_clock' follow

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for DRM_DISPLAY_HDMI_STATE_HELPER
   Depends on [n]: HAS_IOMEM [=y] && DRM [=y] && DRM_DISPLAY_HELPER [=y] && 
DRM_DISPLAY_HDMI_HELPER [=n]
   Selected by [y]:
   - DRM_KUNIT_TEST [=y] && HAS_IOMEM [=y] && DRM [=y] && KUNIT [=y] && MMU [=y]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Re: [RFT PATCH v2 00/48] drm/panel: Remove most store/double-check of prepared/enabled state

2024-05-28 Thread Doug Anderson
Hi,

On Wed, May 8, 2024 at 2:14 PM Doug Anderson  wrote:
>
> > This is the right thing to do, thanks for looking into this!
> >
> > As for the behaviour of .remove() I doubt whether in many cases
> > the original driver authors have even tested this themselves.
>
> Yeah, I'd tend to agree.
>
>
> > I would say we should just apply the series as soon as it's non-RFC
>
> It's not actually RFC now, but "RFT" (request for testing). I don't
> _think_ there's any need to send a version without the RFT tag before
> landing unless someone really feels strongly about it.
>
>
> > after the next merge window
>
> With drm-misc there's not really any specific reason to wait for the
> merge window to open/close as we can land in drm-misc-next at any time
> regardless of the merge window. drm-misc-next will simply stop feeding
> linuxnext for a while.
>
> That all being said, I'm happy to delay landing this until after the
> next -rc1 comes out if people would prefer that. If I don't hear
> anything, I guess I'll just wait until -rc1 before landing any of
> these.
>
>
> > and see what happens. I doubt it
> > will cause much trouble.
>
> I can land the whole series if that's what everyone agrees on. As I
> mentioned above, I'm at least slightly worried that I did something
> stupid _somewhere_ in this series since no automation was possible and
> with repetitive tasks like this it's super easy to flub something up.
> It's _probably_ fine, but I guess I still have the worry in the back
> of my mind.
>
> If folks think I should just apply the whole series then I'm happy to
> do that. If folks think I should just land parts of the series as they
> are reviewed/tested I can do that as well. Let me know. If I don't
> hear anything I'd tend to just land patches that are reviewed/tested.
> Then after a month or so (hopefully) I'd send out a v2 with anything
> left.

Nobody said anything, so I did what I indicated above:

1. I've applied all patches that someone responded to with Linus +
Maxime's Acks + any given tags. This includes the st7703 panels which
Ondřej replied to the cover letter about but didn't officially get any
tags.

2. I also applied patches for panels that I was personally involved
with. This includes panel-edp, panel-simple, samsung-atna33xc20,
boe-tv101wum-nl6.

Anything totally unresponded to I've left unapplied. I'll wait a
little while (at least a week) and then plan to send a v2 with
anything still outstanding. If someone sends Tested-by/Reviewed-by for
some panels in the meantime I'll apply them.

Here are the 25 patches applied to drm-misc-next:

[01/48] drm/panel: raydium-rm692e5: Stop tracking prepared
commit: 598dc42f25cc3060fd350db0f52af1075af3f500

[04/48] drm/panel: boe-tv101wum-nl6: Stop tracking prepared
commit: 3c24e31c908eb12e99420ff33b74c01f045253fe
[05/48] drm/panel: boe-tv101wum-nl6: Don't call unprepare+disable at
shutdown/remove
commit: 1985e3512b5a3777f6a18c36e40f3926037120bb
[06/48] drm/panel: edp: Stop tracking prepared/enabled
commit: 3904f317fd977533f6d7d3c4bfd75e0ac6169bb7
[07/48] drm/panel: edp: Add a comment about unprepare+disable at shutdown/remove
commit: ec7629859331fb67dbfb6bcd47f887a402e390ff
[08/48] drm/panel: innolux-p079zca: Stop tracking prepared/enabled
commit: f9055051292442d52092f17e191cf0a58d23d4ed
[09/48] drm/panel: innolux-p079zca: Don't call unprepare+disable at
shutdown/remove
commit: eeb133ff78476eb1e6e88154dfb75a741e8a034a

[12/48] drm/panel: kingdisplay-kd097d04: Stop tracking prepared/enabled
commit: 157c1381780a453e06430f8b35bb8c5d439eb8c6
[13/48] drm/panel: kingdisplay-kd097d04: Don't call unprepare+disable
at shutdown/remove
commit: 68c205ef3c39edce4a3346b8a53fd2b700394a0c
[14/48] drm/panel: ltk050h3146w: Stop tracking prepared
commit: f124478dd18c519544489caddce78e7c5796a758
[15/48] drm/panel: ltk050h3146w: Don't call unprepare+disable at shutdown/remove
commit: b7ca446ecb53205944968617b158f073bcacaedc
[16/48] drm/panel: ltk500hd1829: Stop tracking prepared
commit: 2b8c19b9d7bc9d03e8c44bd391d21e95c07a2c83
[17/48] drm/panel: ltk500hd1829: Don't call unprepare+disable at shutdown/remove
commit: 3357f6f465e62c0bc5e906365063734740c9f6d4
[18/48] drm/panel: novatek-nt36672a: Stop tracking prepared
commit: b605f257f386b7f4b6fc9c0f82b86b75d0579287
[19/48] drm/panel: novatek-nt36672a: Don't call unprepare+disable at
shutdown/remove
commit: 2a9487b5aa55753993fde80e4841128c8da4df71

[24/48] drm/panel: samsung-atna33xc20: Stop tracking prepared/enabled
commit: 5a847750aac8454a1604070ab99d689c0a6e4290
[25/48] drm/panel: samsung-atna33xc20: Don't call unprepare+disable at
shutdown/remove
commit: 49869668ff0e3f380858b4c20b8d0cb02b933f48
[26/48] drm/panel: simple: Stop tracking prepared/enabled
commit: 2a1c99d7159b798288bfb20a76c1e665e2344126
[27/48] drm/panel: simple: Add a comment about unprepare+disable at
shutdown/remove
 

Re: [PATCH] drm/i915/guc: Enable w/a 14019882105 for DG2 and MTL

2024-05-28 Thread Matt Roper
On Fri, May 24, 2024 at 06:41:20PM -0700, john.c.harri...@intel.com wrote:
> From: John Harrison 
> 
> Enable another workaround that is implemented inside the GuC.
> 
> Signed-off-by: John Harrison 
> ---
>  drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h |  1 +
>  drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c| 32 ---
>  2 files changed, 21 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h 
> b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
> index 525587cfe1af9..37ff539a6963d 100644
> --- a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
> +++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
> @@ -106,6 +106,7 @@ enum {
>   */
>  enum {
>   GUC_WORKAROUND_KLV_SERIALIZED_RA_MODE   = 
> 0x9001,
> + GUC_WORKAROUND_KLV_BLOCK_INTERRUPTS_WHEN_MGSR_BLOCKED   = 
> 0x9002,
>  };
>  
>  #endif /* _ABI_GUC_KLVS_ABI_H */
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c 
> b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
> index c606bb5e3b7b0..6c382785bc60b 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
> @@ -815,23 +815,23 @@ guc_capture_prep_lists(struct intel_guc *guc)
>   return PAGE_ALIGN(total_size);
>  }
>  
> -/* Wa_14019159160 */
> -static u32 guc_waklv_ra_mode(struct intel_guc *guc, u32 offset, u32 remain)
> +static void guc_waklv_enable_simple(struct intel_guc *guc,
> + u32 klv_id, u32 *offset, u32 *remain)
>  {
>   u32 size;
>   u32 klv_entry[] = {
>   /* 16:16 key/length */
> - FIELD_PREP(GUC_KLV_0_KEY, 
> GUC_WORKAROUND_KLV_SERIALIZED_RA_MODE) |
> + FIELD_PREP(GUC_KLV_0_KEY, klv_id) |
>   FIELD_PREP(GUC_KLV_0_LEN, 0),
>   /* 0 dwords data */
>   };
>  
>   size = sizeof(klv_entry);
> - GEM_BUG_ON(remain < size);
> + GEM_BUG_ON(*remain < size);
>  
> - iosys_map_memcpy_to(>ads_map, offset, klv_entry, size);
> -
> - return size;
> + iosys_map_memcpy_to(>ads_map, *offset, klv_entry, size);
> + *offset += size;
> + *remain -= size;
>  }
>  
>  static void guc_waklv_init(struct intel_guc *guc)
> @@ -850,11 +850,19 @@ static void guc_waklv_init(struct intel_guc *guc)
>   remain = guc_ads_waklv_size(guc);
>  
>   /* Wa_14019159160 */
> - if (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71))) {
> - size = guc_waklv_ra_mode(guc, offset, remain);
> - offset += size;
> - remain -= size;
> - }
> + if (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71)))
> + guc_waklv_enable_simple(guc,
> + GUC_WORKAROUND_KLV_SERIALIZED_RA_MODE,
> + , );
> +
> + /* Wa_14019882105 */

Is this the right number?  When I look up Wa_14019882105 in the
workaround database, it only lists it as being relevant to A steppings
of G:20.04.  I don't see entries for 12.70/12.71.  Did it go by a
different lineage number on the older platforms?

Also, I notice the Wa_14019159160 we had just above this workaround is
missing handling for graphics version 12.74.


Matt

> + if ((GUC_FIRMWARE_VER(guc) >= MAKE_GUC_VER(70, 21, 1)) &&
> + (IS_GFX_GT_IP_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71)) ||
> +  IS_MEDIA_GT_IP_RANGE(gt, IP_VER(13, 0), IP_VER(13, 0)) ||
> +  IS_DG2(gt->i915)))
> + guc_waklv_enable_simple(guc,
> + 
> GUC_WORKAROUND_KLV_BLOCK_INTERRUPTS_WHEN_MGSR_BLOCKED,
> + , );
>  
>   size = guc_ads_waklv_size(guc) - remain;
>   if (!size)
> -- 
> 2.43.2
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


Re: [PATCH 07/21] drm/sti: Allow build with COMPILE_TEST=y

2024-05-28 Thread Ville Syrjälä
On Mon, May 27, 2024 at 05:29:09PM +0200, Alain Volmat wrote:
> Hi Ville,
> 
> thank you for your patch.
> 
> On Mon, Apr 08, 2024 at 08:04:12PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä 
> > 
> > Allow sti to be built with COMPILE_TEST=y for greater
> > coverage. Builds fine on x86/x86_64 at least.
> > 
> > Cc: Alain Volmat 
> > Signed-off-by: Ville Syrjälä 
> > ---
> >  drivers/gpu/drm/sti/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
> > index 3c7a5feff8de..75c301aadcbc 100644
> > --- a/drivers/gpu/drm/sti/Kconfig
> > +++ b/drivers/gpu/drm/sti/Kconfig
> > @@ -1,7 +1,7 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> >  config DRM_STI
> > tristate "DRM Support for STMicroelectronics SoC stiH4xx Series"
> > -   depends on OF && DRM && ARCH_STI
> > +   depends on OF && DRM && (ARCH_STI || COMPILE_TEST)
> > select RESET_CONTROLLER
> > select DRM_KMS_HELPER
> > select DRM_GEM_DMA_HELPER
> > -- 
> > 2.43.2
> > 
> 
> Acked-by: Alain Volmat 

Thanks. Pushed both sti patches to drm-misc-next.

-- 
Ville Syrjälä
Intel


[PATCH] drm/msm/adreno: Add A306A support

2024-05-28 Thread Barnabás Czémán
From: Otto Pflüger 

Add support for Adreno 306A GPU what is found in MSM8917 SoC.
This GPU marketing name is Adreno 308.

Signed-off-by: Otto Pflüger 
[use internal name of the GPU, reword the commit message]
Signed-off-by: Barnabás Czémán 
---
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c  | 14 +++---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 11 +++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h|  6 ++
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
index 5273dc849838..b46ff49f47cf 100644
--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
@@ -145,6 +145,10 @@ static int a3xx_hw_init(struct msm_gpu *gpu)
gpu_write(gpu, REG_A3XX_VBIF_ROUND_ROBIN_QOS_ARB, 0x0003);
gpu_write(gpu, REG_A3XX_VBIF_OUT_RD_LIM_CONF0, 0x000a);
gpu_write(gpu, REG_A3XX_VBIF_OUT_WR_LIM_CONF0, 0x000a);
+   } else if (adreno_is_a306a(adreno_gpu)) {
+   gpu_write(gpu, REG_A3XX_VBIF_ROUND_ROBIN_QOS_ARB, 0x0003);
+   gpu_write(gpu, REG_A3XX_VBIF_OUT_RD_LIM_CONF0, 0x0010);
+   gpu_write(gpu, REG_A3XX_VBIF_OUT_WR_LIM_CONF0, 0x0010);
} else if (adreno_is_a320(adreno_gpu)) {
/* Set up 16 deep read/write request queues: */
gpu_write(gpu, REG_A3XX_VBIF_IN_RD_LIM_CONF0, 0x10101010);
@@ -237,7 +241,9 @@ static int a3xx_hw_init(struct msm_gpu *gpu)
gpu_write(gpu, REG_A3XX_UCHE_CACHE_MODE_CONTROL_REG, 0x0001);
 
/* Enable Clock gating: */
-   if (adreno_is_a305b(adreno_gpu) || adreno_is_a306(adreno_gpu))
+   if (adreno_is_a305b(adreno_gpu) ||
+   adreno_is_a306(adreno_gpu) ||
+   adreno_is_a306a(adreno_gpu))
gpu_write(gpu, REG_A3XX_RBBM_CLOCK_CTL, 0x);
else if (adreno_is_a320(adreno_gpu))
gpu_write(gpu, REG_A3XX_RBBM_CLOCK_CTL, 0xbfff);
@@ -334,8 +340,10 @@ static int a3xx_hw_init(struct msm_gpu *gpu)
gpu_write(gpu, REG_A3XX_CP_PFP_UCODE_DATA, ptr[i]);
 
/* CP ROQ queue sizes (bytes) - RB:16, ST:16, IB1:32, IB2:64 */
-   if (adreno_is_a305(adreno_gpu) || adreno_is_a306(adreno_gpu) ||
-   adreno_is_a320(adreno_gpu)) {
+   if (adreno_is_a305(adreno_gpu) ||
+   adreno_is_a306(adreno_gpu) ||
+   adreno_is_a306a(adreno_gpu) ||
+   adreno_is_a320(adreno_gpu)) {
gpu_write(gpu, REG_AXXX_CP_QUEUE_THRESHOLDS,
AXXX_CP_QUEUE_THRESHOLDS_CSQ_IB1_START(2) |
AXXX_CP_QUEUE_THRESHOLDS_CSQ_IB2_START(6) |
diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c 
b/drivers/gpu/drm/msm/adreno/adreno_device.c
index c3703a51287b..198b2b5b67fb 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -86,6 +86,17 @@ static const struct adreno_info gpulist[] = {
.gmem  = SZ_128K,
.inactive_period = DRM_MSM_INACTIVE_PERIOD,
.init  = a3xx_gpu_init,
+   }, {
+   .chip_ids = ADRENO_CHIP_IDS(0x03000620),
+   .family = ADRENO_3XX,
+   .revn  = 308,
+   .fw = {
+   [ADRENO_FW_PM4] = "a300_pm4.fw",
+   [ADRENO_FW_PFP] = "a300_pfp.fw",
+   },
+   .gmem  = SZ_128K,
+   .inactive_period = DRM_MSM_INACTIVE_PERIOD,
+   .init  = a3xx_gpu_init,
}, {
.chip_ids = ADRENO_CHIP_IDS(
0x0302,
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index 77526892eb8c..2645f6f4ad83 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
@@ -268,6 +268,12 @@ static inline bool adreno_is_a306(const struct adreno_gpu 
*gpu)
return adreno_is_revn(gpu, 307);
 }
 
+static inline bool adreno_is_a306a(const struct adreno_gpu *gpu)
+{
+   /* a306a marketing name is a308 */
+   return adreno_is_revn(gpu, 308);
+}
+
 static inline bool adreno_is_a320(const struct adreno_gpu *gpu)
 {
return adreno_is_revn(gpu, 320);

---
base-commit: 6dc544b66971c7f9909ff038b62149105272d26a
change-id: 20240528-a306a-48e173724d6c

Best regards,
-- 
Barnabás Czémán 



[PATCH v4 2/3] drm/panel/lg-sw43408: mark sw43408_backlight_ops as static

2024-05-28 Thread Dmitry Baryshkov
Fix sparse warning regarding symbol 'sw43408_backlight_ops' not being
declared.

Reported-by: kernel test robot 
Closes: 
https://lore.kernel.org/oe-kbuild-all/202404200739.hbwzvohr-...@intel.com/
Reviewed-by: Neil Armstrong 
Fixes: 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver")
Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/panel/panel-lg-sw43408.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c 
b/drivers/gpu/drm/panel/panel-lg-sw43408.c
index 115f4702d59f..2b3a73696dce 100644
--- a/drivers/gpu/drm/panel/panel-lg-sw43408.c
+++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c
@@ -182,7 +182,7 @@ static int sw43408_backlight_update_status(struct 
backlight_device *bl)
return mipi_dsi_dcs_set_display_brightness_large(dsi, brightness);
 }
 
-const struct backlight_ops sw43408_backlight_ops = {
+static const struct backlight_ops sw43408_backlight_ops = {
.update_status = sw43408_backlight_update_status,
 };
 

-- 
2.39.2



[PATCH v4 3/3] drm/display: split DSC helpers from DP helpers

2024-05-28 Thread Dmitry Baryshkov
Currently the DRM DSC functions are selected by the
DRM_DISPLAY_DP_HELPER Kconfig symbol. This is not optimal, since the DSI
code (both panel and host drivers) end up selecting the seemingly
irrelevant DP helpers. Split the DSC code to be guarded by the separate
DRM_DISPLAY_DSC_HELPER Kconfig symbol.

Reviewed-by: Jessica Zhang 
Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/amd/amdgpu/Kconfig | 1 +
 drivers/gpu/drm/display/Kconfig| 6 ++
 drivers/gpu/drm/display/Makefile   | 3 ++-
 drivers/gpu/drm/i915/Kconfig   | 1 +
 drivers/gpu/drm/msm/Kconfig| 1 +
 drivers/gpu/drm/panel/Kconfig  | 6 +++---
 6 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig 
b/drivers/gpu/drm/amd/amdgpu/Kconfig
index 4232ab27f990..5933ca8c6b96 100644
--- a/drivers/gpu/drm/amd/amdgpu/Kconfig
+++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
@@ -6,6 +6,7 @@ config DRM_AMDGPU
depends on !UML
select FW_LOADER
select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HDMI_HELPER
select DRM_DISPLAY_HDCP_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/display/Kconfig b/drivers/gpu/drm/display/Kconfig
index 864a6488bfdf..f524cf95dec3 100644
--- a/drivers/gpu/drm/display/Kconfig
+++ b/drivers/gpu/drm/display/Kconfig
@@ -59,6 +59,12 @@ config DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG
 
  If in doubt, say "N".
 
+config DRM_DISPLAY_DSC_HELPER
+   bool
+   depends on DRM_DISPLAY_HELPER
+   help
+ DRM display helpers for VESA DSC (used by DSI and DisplayPort).
+
 config DRM_DISPLAY_HDCP_HELPER
bool
depends on DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/display/Makefile b/drivers/gpu/drm/display/Makefile
index 17d2cc73ff56..2ec71e15c3cb 100644
--- a/drivers/gpu/drm/display/Makefile
+++ b/drivers/gpu/drm/display/Makefile
@@ -6,7 +6,8 @@ drm_display_helper-y := drm_display_helper_mod.o
 drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_HELPER) += \
drm_dp_dual_mode_helper.o \
drm_dp_helper.o \
-   drm_dp_mst_topology.o \
+   drm_dp_mst_topology.o
+drm_display_helper-$(CONFIG_DRM_DISPLAY_DSC_HELPER) += \
drm_dsc_helper.o
 drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_TUNNEL) += \
drm_dp_tunnel.o
diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index 5932024f8f95..117b84260b1c 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -11,6 +11,7 @@ config DRM_I915
select SHMEM
select TMPFS
select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HDCP_HELPER
select DRM_DISPLAY_HDMI_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 1931ecf73e32..6dcd26180611 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -111,6 +111,7 @@ config DRM_MSM_DSI
depends on DRM_MSM
select DRM_PANEL
select DRM_MIPI_DSI
+   select DRM_DISPLAY_DSC_HELPER
default y
help
  Choose this option if you have a need for MIPI DSI connector
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 2ae0eb0638f3..3e3f63479544 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -340,7 +340,7 @@ config DRM_PANEL_LG_SW43408
depends on OF
depends on DRM_MIPI_DSI
depends on BACKLIGHT_CLASS_DEVICE
-   select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HELPER
help
  Say Y here if you want to enable support for LG sw43408 panel.
@@ -549,7 +549,7 @@ config DRM_PANEL_RAYDIUM_RM692E5
depends on OF
depends on DRM_MIPI_DSI
depends on BACKLIGHT_CLASS_DEVICE
-   select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HELPER
help
  Say Y here if you want to enable support for Raydium RM692E5-based
@@ -907,7 +907,7 @@ config DRM_PANEL_VISIONOX_R66451
depends on OF
depends on DRM_MIPI_DSI
depends on BACKLIGHT_CLASS_DEVICE
-   select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HELPER
help
  Say Y here if you want to enable support for Visionox

-- 
2.39.2



[PATCH v4 0/3] drm/panel: two fixes for lg-sw43408

2024-05-28 Thread Dmitry Baryshkov
Fix two issues with the panel-lg-sw43408 driver reported by the kernel
test robot.

Signed-off-by: Dmitry Baryshkov 
---
Changes in v4:
- Reoder patches so that fixes come first, to be able to land them to
  drm-misc-fixes
- Link to v3: 
https://lore.kernel.org/r/20240522-panel-sw43408-fix-v3-0-6902285ad...@linaro.org

Changes in v3:
- Split DRM_DISPLAY_DSC_HELPER from DRM_DISPLAY_DP_HELPER
- Added missing Fixes tags
- Link to v2: 
https://lore.kernel.org/r/20240510-panel-sw43408-fix-v2-0-d1ef91ee1...@linaro.org

Changes in v2:
- use SELECT instead of DEPEND to follow the reverted Kconfig changes
- Link to v1: 
https://lore.kernel.org/r/20240420-panel-sw43408-fix-v1-0-b282ff725...@linaro.org

---
Dmitry Baryshkov (3):
  drm/panel/lg-sw43408: select CONFIG_DRM_DISPLAY_DP_HELPER
  drm/panel/lg-sw43408: mark sw43408_backlight_ops as static
  drm/display: split DSC helpers from DP helpers

 drivers/gpu/drm/amd/amdgpu/Kconfig   | 1 +
 drivers/gpu/drm/display/Kconfig  | 6 ++
 drivers/gpu/drm/display/Makefile | 3 ++-
 drivers/gpu/drm/i915/Kconfig | 1 +
 drivers/gpu/drm/msm/Kconfig  | 1 +
 drivers/gpu/drm/panel/Kconfig| 6 --
 drivers/gpu/drm/panel/panel-lg-sw43408.c | 2 +-
 7 files changed, 16 insertions(+), 4 deletions(-)
---
base-commit: 6dc544b66971c7f9909ff038b62149105272d26a
change-id: 20240420-panel-sw43408-fix-ff6549c121be

Best regards,
-- 
Dmitry Baryshkov 



[PATCH v4 1/3] drm/panel/lg-sw43408: select CONFIG_DRM_DISPLAY_DP_HELPER

2024-05-28 Thread Dmitry Baryshkov
This panel driver uses DSC PPS functions and as such depends on the
DRM_DISPLAY_DP_HELPER. Select this symbol to make required functions
available to the driver.

Reported-by: kernel test robot 
Closes: 
https://lore.kernel.org/oe-kbuild-all/202404200800.kysryyli-...@intel.com/
Fixes: 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver")
Reviewed-by: Neil Armstrong 
Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/panel/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 982324ef5a41..2ae0eb0638f3 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -340,6 +340,8 @@ config DRM_PANEL_LG_SW43408
depends on OF
depends on DRM_MIPI_DSI
depends on BACKLIGHT_CLASS_DEVICE
+   select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_HELPER
help
  Say Y here if you want to enable support for LG sw43408 panel.
  The panel has a 1080x2160@60Hz resolution and uses 24 bit RGB per

-- 
2.39.2



Re: [PATCH 4/9] drm/i915: Introduce fb->min_alignment

2024-05-28 Thread Ville Syrjälä
On Tue, May 28, 2024 at 02:27:52PM +0300, Imre Deak wrote:
> On Mon, May 13, 2024 at 08:59:37PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä 
> > 
> > Different planes could have different alignment requirements
> > even for the same format/modifier. Collect the alignment
> > requirements across all planes capable of scanning out the
> > fb such that the alignment used when pinning the normal ggtt
> > view is satisfactory to all those planes.
> > 
> > When pinning per-plane views we only have to satisfy the
> > alignment requirements of the specific plane.
> > 
> > Signed-off-by: Ville Syrjälä 
> > ---
> >  .../drm/i915/display/intel_display_types.h|  2 ++
> >  drivers/gpu/drm/i915/display/intel_fb.c   | 23 
> >  drivers/gpu/drm/i915/display/intel_fb_pin.c   | 27 +--
> >  drivers/gpu/drm/i915/display/intel_fbdev.c| 18 +
> >  4 files changed, 51 insertions(+), 19 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > index 40d6e5f4c350..58bb65832adf 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > @@ -145,6 +145,8 @@ struct intel_framebuffer {
> > };
> >  
> > struct i915_address_space *dpt_vm;
> > +
> > +   unsigned int min_alignment;
> >  };
> >  
> >  enum intel_hotplug_state {
> > diff --git a/drivers/gpu/drm/i915/display/intel_fb.c 
> > b/drivers/gpu/drm/i915/display/intel_fb.c
> > index 3f3a9cd534f4..c5bae05cbbc3 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fb.c
> > +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> > @@ -10,6 +10,7 @@
> >  #include 
> >  
> >  #include "i915_drv.h"
> > +#include "intel_atomic_plane.h"
> >  #include "intel_display.h"
> >  #include "intel_display_types.h"
> >  #include "intel_dpt.h"
> > @@ -1616,6 +1617,26 @@ bool intel_fb_supports_90_270_rotation(const struct 
> > intel_framebuffer *fb)
> >fb->base.modifier == I915_FORMAT_MOD_Yf_TILED;
> >  }
> >  
> > +static unsigned int intel_fb_min_alignment(const struct drm_framebuffer 
> > *fb)
> > +{
> > +   struct drm_i915_private *i915 = to_i915(fb->dev);
> > +   struct intel_plane *plane;
> > +   unsigned int min_alignment = 0;
> > +
> > +   for_each_intel_plane(>drm, plane) {
> > +   if (!drm_plane_has_format(>base, fb->format->format, 
> > fb->modifier))
> > +   continue;
> > +
> > +   if (intel_plane_needs_physical(plane))
> > +   continue;
> > +
> > +   min_alignment = max(min_alignment,
> > +   plane->min_alignment(plane, fb, 0));
> > +   }
> > +
> > +   return min_alignment;
> > +}
> > +
> >  int intel_fill_fb_info(struct drm_i915_private *i915, struct 
> > intel_framebuffer *fb)
> >  {
> > struct drm_i915_gem_object *obj = intel_fb_obj(>base);
> > @@ -1698,6 +1719,8 @@ int intel_fill_fb_info(struct drm_i915_private *i915, 
> > struct intel_framebuffer *
> > return -EINVAL;
> > }
> >  
> > +   fb->min_alignment = intel_fb_min_alignment(>base);
> > +
> > return 0;
> >  }
> >  
> > diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.c 
> > b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > index 9b0f1ea41b70..1ae02de906f5 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > +++ b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> > @@ -230,13 +230,36 @@ void intel_fb_unpin_vma(struct i915_vma *vma, 
> > unsigned long flags)
> > i915_vma_put(vma);
> >  }
> >  
> > +static bool gtt_view_is_per_plane(const struct intel_plane_state 
> > *plane_state)
> > +{
> > +   const struct intel_framebuffer *fb = 
> > to_intel_framebuffer(plane_state->hw.fb);
> > +
> > +   if (plane_state->view.gtt.type == I915_GTT_VIEW_REMAPPED &&
> > +   intel_fb_needs_pot_stride_remap(fb))
> > +   return false;
> 
> The above view is created only once for the FB, I suppose this is how
> you differentiate it from views created each time due to a stride
> limit (based on intel_plane_needs_remap()).
> 
> > +
> > +   return plane_state->view.gtt.type != I915_GTT_VIEW_NORMAL;
> 
> So the rotated and remapped views created for a stride limit are
> per-plane based on the above. There is also a rotated view created only
> once for the FB, is it intentional to regard this kind of view as
> per-plane as well?

No. Forgot those exist. I guess I should just remove this per-plane
alignment logic for now. Need to think of a proper way to add it back,
or just quietly bury the whole idea.

> 
> > +}
> > +
> >  static unsigned int
> >  intel_plane_fb_min_alignment(const struct intel_plane_state *plane_state)
> >  {
> > struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
> > -   const struct drm_framebuffer *fb = plane_state->hw.fb;
> > +   const struct intel_framebuffer *fb = 
> > to_intel_framebuffer(plane_state->hw.fb);
> >  
> > -   return 

[drm-misc:drm-misc-next 10/29] ld.lld: error: undefined symbol: drm_hdmi_compute_mode_clock

2024-05-28 Thread kernel test robot
tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head:   c7ce956bb6d0f32ab921b6ffba1a6a834df96f21
commit: abb6f74973e20956d42e8227dde6fb4e92502c14 [10/29] drm/tests: Add HDMI 
TDMS character rate tests
config: i386-buildonly-randconfig-006-20240528 
(https://download.01.org/0day-ci/archive/20240529/202405290332.sqtt0ix0-...@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 
617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240529/202405290332.sqtt0ix0-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202405290332.sqtt0ix0-...@intel.com/

All errors (new ones prefixed by >>):

>> ld.lld: error: undefined symbol: drm_hdmi_compute_mode_clock
   >>> referenced by drm_connector_test.c
   >>>   
drivers/gpu/drm/tests/drm_connector_test.o:(drm_test_drm_hdmi_compute_mode_clock_rgb)
 in archive vmlinux.a
   >>> referenced by drm_connector_test.c
   >>>   
drivers/gpu/drm/tests/drm_connector_test.o:(drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc)
 in archive vmlinux.a
   >>> referenced by drm_connector_test.c
   >>>   
drivers/gpu/drm/tests/drm_connector_test.o:(drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc_vic_1)
 in archive vmlinux.a
   >>> referenced 9 more times

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for DRM_DISPLAY_HDMI_STATE_HELPER
   Depends on [n]: HAS_IOMEM [=y] && DRM [=y] && DRM_DISPLAY_HELPER [=y] && 
DRM_DISPLAY_HDMI_HELPER [=n]
   Selected by [y]:
   - DRM_KUNIT_TEST [=y] && HAS_IOMEM [=y] && DRM [=y] && KUNIT [=y] && MMU [=y]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Re: [PATCH 8/9] drm/i915: Update plane alignment requirements for TGL+

2024-05-28 Thread Ville Syrjälä
On Tue, May 28, 2024 at 04:22:59PM +0300, Imre Deak wrote:
> On Mon, May 13, 2024 at 08:59:41PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä 
> > 
> > Currently we still use the SKL+ PLANE_SURF alignment even
> > for TGL+ even though the hardware no longer needs it.
> > Introduce a separate tgl_plane_min_alignment() and update
> > it to more accurately reflect the hardware requirements.
> > 
> > Signed-off-by: Ville Syrjälä 
> > ---
> >  .../drm/i915/display/skl_universal_plane.c| 103 ++
> >  1 file changed, 55 insertions(+), 48 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c 
> > b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > index 1ecd7c691317..ca7fc9fae990 100644
> > --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > @@ -502,75 +502,79 @@ skl_plane_max_stride(struct intel_plane *plane,
> > max_pixels, max_bytes);
> >  }
> >  
> > -static unsigned int skl_plane_min_alignment(struct intel_plane *plane,
> > -   const struct drm_framebuffer *fb,
> > -   int color_plane)
> > +static u32 tgl_plane_min_alignment(struct intel_plane *plane,
> > +  const struct drm_framebuffer *fb,
> > +  int color_plane)
> >  {
> > -   struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> > -
> > -   if (intel_fb_uses_dpt(fb)) {
> > -   /* AUX_DIST needs only 4K alignment */
> > -   if (intel_fb_is_ccs_aux_plane(fb, color_plane))
> > -   return 512 * 4096;
> > -
> > -   /*
> > -* FIXME ADL sees GGTT/DMAR faults with async
> > -* flips unless we align to 16k at least.
> > -* Figure out what's going on here...
> > -*/
> > -   if (IS_ALDERLAKE_P(dev_priv) &&
> > -   !intel_fb_is_ccs_modifier(fb->modifier) &&
> > -   HAS_ASYNC_FLIPS(dev_priv))
> > -   return 512 * 16 * 1024;
> > -
> > -   return 512 * 4096;
> > -   }
> > +   struct drm_i915_private *i915 = to_i915(plane->base.dev);
> > +   /* PLANE_SURF GGTT -> DPT alignment */
> > +   int mult = intel_fb_uses_dpt(fb) ? 512 : 1;
> >  
> > /* AUX_DIST needs only 4K alignment */
> > if (intel_fb_is_ccs_aux_plane(fb, color_plane))
> > -   return 4096;
> > +   return mult * 4 * 1024;
> >  
> > if (is_semiplanar_uv_plane(fb, color_plane)) {
> > /*
> >  * TODO: cross-check wrt. the bspec stride in bytes * 64 bytes
> >  * alignment for linear UV planes on all platforms.
> >  */
> > -   if (DISPLAY_VER(dev_priv) >= 12) {
> > -   if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
> > -   return 256 * 1024;
> > -
> > -   return intel_tile_row_size(fb, color_plane);
> > -   }
> > -
> > -   return 4096;
> > -   }
> > -
> > -   drm_WARN_ON(_priv->drm, color_plane != 0);
> > -
> > -   switch (fb->modifier) {
> > -   case DRM_FORMAT_MOD_LINEAR:
> > -   return 256 * 1024;
> > -   case I915_FORMAT_MOD_X_TILED:
> > -   if (HAS_ASYNC_FLIPS(dev_priv))
> > +   if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
> > return 256 * 1024;
> > -   return 0;
> > +
> > +   return intel_tile_row_size(fb, color_plane);
> > +   }
> > +
> > +   switch (fb->modifier) {
> > +   case DRM_FORMAT_MOD_LINEAR:
> > +   case I915_FORMAT_MOD_X_TILED:
> > +   case I915_FORMAT_MOD_Y_TILED:
> > +   case I915_FORMAT_MOD_4_TILED:
> > +   /*
> > +* FIXME ADL sees GGTT/DMAR faults with async
> > +* flips unless we align to 16k at least.
> > +* Figure out what's going on here...
> > +*/
> > +   if (IS_ALDERLAKE_P(i915) && HAS_ASYNC_FLIPS(i915))
> 
> On ADL HAS_ASYNC_FLIPS() is always true, otherwise looks ok:

I've been using HAS_ASYNC_FLIPS() to just flag the async flip
specific restrictions. So mainly an aide memoire, but it can
technically be used to also test with less alignment
by just neutering HAS_ASYNC_FLIPS(), without having go trawl
the specs for the specific number again.

Though I'm not super happy how this looks when combine
with the async flip modifier restrictions. Haven't yet
figured out how it actually should look in the though.

> 
> Reviewed-by: Imre Deak 
> 
> > +   return mult * 16 * 1024;
> > +   return mult * 4 * 1024;
> > case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
> > case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
> > case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
> > +   case I915_FORMAT_MOD_4_TILED_DG2_MC_CCS:
> > +   case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS:
> > +   case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC:
> > case I915_FORMAT_MOD_4_TILED_MTL_MC_CCS:
> > case 

Re: [linux-next:master] BUILD REGRESSION 6dc544b66971c7f9909ff038b62149105272d26a

2024-05-28 Thread Jakub Kicinski
On Wed, 29 May 2024 02:19:47 +0800 kernel test robot wrote:
> |   `-- 
> net-ipv6-route.c-rt6_fill_node()-error:we-previously-assumed-dst-could-be-null-(see-line-)

Is there a way for us to mark this as false positive?


[linux-next:master] BUILD REGRESSION 6dc544b66971c7f9909ff038b62149105272d26a

2024-05-28 Thread kernel test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
branch HEAD: 6dc544b66971c7f9909ff038b62149105272d26a  Add linux-next specific 
files for 20240528

Error/Warning reports:

https://lore.kernel.org/oe-kbuild-all/202405282036.maedo54q-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202405282148.jaf0flhu-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202405282308.uezt6hqc-...@intel.com

Error/Warning: (recently discovered and may have been fixed)

drivers/dma-buf/udmabuf.c:45:(.text+0x140): undefined reference to 
`vmf_insert_pfn'
fs/btrfs/fiemap.c:822:26: warning: 'last_extent_end' may be used uninitialized 
[-Wmaybe-uninitialized]

Error/Warning ids grouped by kconfigs:

gcc_recent_errors
|-- alpha-allyesconfig
|   |-- 
drivers-gpu-drm-imx-ipuv3-imx-ldb.c:error:_sel-directive-output-may-be-truncated-writing-bytes-into-a-region-of-size-between-and
|   |-- 
drivers-gpu-drm-nouveau-nouveau_backlight.c:error:d-directive-output-may-be-truncated-writing-between-and-bytes-into-a-region-of-size
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- arc-allmodconfig
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- arc-allyesconfig
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- arm-allmodconfig
|   |-- 
drivers-gpu-drm-imx-ipuv3-imx-ldb.c:error:_sel-directive-output-may-be-truncated-writing-bytes-into-a-region-of-size-between-and
|   |-- 
drivers-gpu-drm-nouveau-nouveau_backlight.c:error:d-directive-output-may-be-truncated-writing-between-and-bytes-into-a-region-of-size
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- arm-allyesconfig
|   |-- 
drivers-gpu-drm-imx-ipuv3-imx-ldb.c:error:_sel-directive-output-may-be-truncated-writing-bytes-into-a-region-of-size-between-and
|   |-- 
drivers-gpu-drm-nouveau-nouveau_backlight.c:error:d-directive-output-may-be-truncated-writing-between-and-bytes-into-a-region-of-size
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- arm-randconfig-001-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- arm-randconfig-002-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- arm64-randconfig-003-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- csky-allmodconfig
|   |-- 
drivers-gpu-drm-imx-ipuv3-imx-ldb.c:error:_sel-directive-output-may-be-truncated-writing-bytes-into-a-region-of-size-between-and
|   |-- 
drivers-gpu-drm-nouveau-nouveau_backlight.c:error:d-directive-output-may-be-truncated-writing-between-and-bytes-into-a-region-of-size
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- csky-allyesconfig
|   |-- 
drivers-gpu-drm-imx-ipuv3-imx-ldb.c:error:_sel-directive-output-may-be-truncated-writing-bytes-into-a-region-of-size-between-and
|   |-- 
drivers-gpu-drm-nouveau-nouveau_backlight.c:error:d-directive-output-may-be-truncated-writing-between-and-bytes-into-a-region-of-size
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- csky-randconfig-001-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- csky-randconfig-002-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- i386-allmodconfig
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- i386-allyesconfig
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- i386-buildonly-randconfig-001-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- i386-randconfig-003-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- i386-randconfig-004-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- i386-randconfig-005-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- i386-randconfig-006-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- i386-randconfig-015-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- i386-randconfig-016-20240528
|   `-- 
drivers-regulator-rtq2208-regulator.c:warning:rtq2208_regulator_ldo_ops-defined-but-not-used
|-- loongarch-allmodconfig
|   |-- 
drivers-gpu-drm-imx-ipuv3-imx-ldb.c:error:_sel-directive-output-may

Re: [PATCH v3 1/3] drm/display: split DSC helpers from DP helpers

2024-05-28 Thread Jessica Zhang




On 5/21/2024 11:25 PM, Dmitry Baryshkov wrote:

Currently the DRM DSC functions are selected by the
DRM_DISPLAY_DP_HELPER Kconfig symbol. This is not optimal, since the DSI
code (both panel and host drivers) end up selecting the seemingly
irrelevant DP helpers. Split the DSC code to be guarded by the separate
DRM_DISPLAY_DSC_HELPER Kconfig symbol.

Signed-off-by: Dmitry Baryshkov 


Hi Dmitry,

LGTM

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/amd/amdgpu/Kconfig | 1 +
  drivers/gpu/drm/display/Kconfig| 6 ++
  drivers/gpu/drm/display/Makefile   | 3 ++-
  drivers/gpu/drm/i915/Kconfig   | 1 +
  drivers/gpu/drm/msm/Kconfig| 1 +
  drivers/gpu/drm/panel/Kconfig  | 4 ++--
  6 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig 
b/drivers/gpu/drm/amd/amdgpu/Kconfig
index 22d88f8ef527..b69d5c4a5367 100644
--- a/drivers/gpu/drm/amd/amdgpu/Kconfig
+++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
@@ -6,6 +6,7 @@ config DRM_AMDGPU
depends on !UML
select FW_LOADER
select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HDMI_HELPER
select DRM_DISPLAY_HDCP_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/display/Kconfig b/drivers/gpu/drm/display/Kconfig
index 864a6488bfdf..f524cf95dec3 100644
--- a/drivers/gpu/drm/display/Kconfig
+++ b/drivers/gpu/drm/display/Kconfig
@@ -59,6 +59,12 @@ config DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG
  
  	  If in doubt, say "N".
  
+config DRM_DISPLAY_DSC_HELPER

+   bool
+   depends on DRM_DISPLAY_HELPER
+   help
+ DRM display helpers for VESA DSC (used by DSI and DisplayPort).
+
  config DRM_DISPLAY_HDCP_HELPER
bool
depends on DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/display/Makefile b/drivers/gpu/drm/display/Makefile
index 17d2cc73ff56..2ec71e15c3cb 100644
--- a/drivers/gpu/drm/display/Makefile
+++ b/drivers/gpu/drm/display/Makefile
@@ -6,7 +6,8 @@ drm_display_helper-y := drm_display_helper_mod.o
  drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_HELPER) += \
drm_dp_dual_mode_helper.o \
drm_dp_helper.o \
-   drm_dp_mst_topology.o \
+   drm_dp_mst_topology.o
+drm_display_helper-$(CONFIG_DRM_DISPLAY_DSC_HELPER) += \
drm_dsc_helper.o
  drm_display_helper-$(CONFIG_DRM_DISPLAY_DP_TUNNEL) += \
drm_dp_tunnel.o
diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index 5932024f8f95..117b84260b1c 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -11,6 +11,7 @@ config DRM_I915
select SHMEM
select TMPFS
select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HDCP_HELPER
select DRM_DISPLAY_HDMI_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 1931ecf73e32..6dcd26180611 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -111,6 +111,7 @@ config DRM_MSM_DSI
depends on DRM_MSM
select DRM_PANEL
select DRM_MIPI_DSI
+   select DRM_DISPLAY_DSC_HELPER
default y
help
  Choose this option if you have a need for MIPI DSI connector
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 982324ef5a41..4a2f621433ef 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -547,7 +547,7 @@ config DRM_PANEL_RAYDIUM_RM692E5
depends on OF
depends on DRM_MIPI_DSI
depends on BACKLIGHT_CLASS_DEVICE
-   select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HELPER
help
  Say Y here if you want to enable support for Raydium RM692E5-based
@@ -905,7 +905,7 @@ config DRM_PANEL_VISIONOX_R66451
depends on OF
depends on DRM_MIPI_DSI
depends on BACKLIGHT_CLASS_DEVICE
-   select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HELPER
help
  Say Y here if you want to enable support for Visionox

--
2.39.2



[Bug 218900] amdgpu: Fatal error during GPU init

2024-05-28 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=218900

Mario Limonciello (AMD) (mario.limoncie...@amd.com) changed:

   What|Removed |Added

 CC||mario.limoncie...@amd.com

--- Comment #4 from Mario Limonciello (AMD) (mario.limoncie...@amd.com) ---
Possibly the same as this report:

https://lore.kernel.org/all/20240527192159.GEZlTdV7OoOuJrHmI0@fat_crate.local/

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

Re: [PATCH net-next v9 11/14] tcp: RX path for devmem TCP

2024-05-28 Thread Mina Almasry
On Wed, May 22, 2024 at 11:02 PM David Wei  wrote:
>
> On 2024-05-10 16:21, Mina Almasry wrote:
> > +/* On error, returns the -errno. On success, returns number of bytes sent 
> > to the
> > + * user. May not consume all of @remaining_len.
> > + */
> > +static int tcp_recvmsg_dmabuf(struct sock *sk, const struct sk_buff *skb,
> > +   unsigned int offset, struct msghdr *msg,
> > +   int remaining_len)
> > +{
> > + struct dmabuf_cmsg dmabuf_cmsg = { 0 };
> > + struct tcp_xa_pool tcp_xa_pool;
> > + unsigned int start;
> > + int i, copy, n;
> > + int sent = 0;
> > + int err = 0;
> > +
> > + tcp_xa_pool.max = 0;
> > + tcp_xa_pool.idx = 0;
> > + do {
> > + start = skb_headlen(skb);
> > +
> > + if (skb_frags_readable(skb)) {
> > + err = -ENODEV;
> > + goto out;
> > + }
> > +
> > + /* Copy header. */
> > + copy = start - offset;
> > + if (copy > 0) {
> > + copy = min(copy, remaining_len);
> > +
> > + n = copy_to_iter(skb->data + offset, copy,
> > +  >msg_iter);
> > + if (n != copy) {
> > + err = -EFAULT;
> > + goto out;
> > + }
> > +
> > + offset += copy;
> > + remaining_len -= copy;
> > +
> > + /* First a dmabuf_cmsg for # bytes copied to user
> > +  * buffer.
> > +  */
> > + memset(_cmsg, 0, sizeof(dmabuf_cmsg));
> > + dmabuf_cmsg.frag_size = copy;
> > + err = put_cmsg(msg, SOL_SOCKET, SO_DEVMEM_LINEAR,
> > +sizeof(dmabuf_cmsg), _cmsg);
> > + if (err || msg->msg_flags & MSG_CTRUNC) {
> > + msg->msg_flags &= ~MSG_CTRUNC;
> > + if (!err)
> > + err = -ETOOSMALL;
> > + goto out;
> > + }
> > +
> > + sent += copy;
> > +
> > + if (remaining_len == 0)
> > + goto out;
> > + }
> > +
> > + /* after that, send information of dmabuf pages through a
> > +  * sequence of cmsg
> > +  */
> > + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> > + skb_frag_t *frag = _shinfo(skb)->frags[i];
> > + struct net_iov *niov;
> > + u64 frag_offset;
> > + int end;
> > +
> > + /* !skb_frags_readable() should indicate that ALL the
> > +  * frags in this skb are dmabuf net_iovs. We're 
> > checking
> > +  * for that flag above, but also check individual 
> > frags
> > +  * here. If the tcp stack is not setting
> > +  * skb_frags_readable() correctly, we still don't want
> > +  * to crash here.
> > +  */
> > + if (!skb_frag_net_iov(frag)) {
> > + net_err_ratelimited("Found non-dmabuf skb 
> > with net_iov");
> > + err = -ENODEV;
> > + goto out;
> > + }
> > +
> > + niov = skb_frag_net_iov(frag);
>
> Sorry if we've already discussed this.
>
> We have this additional hunk:
>
> + if (niov->pp->mp_ops != _devmem_ops) {
> +   err = -ENODEV;
> +   goto out;
> + }
>
> In case one of our skbs end up here, skb_frag_is_net_iov() and
> !skb_frags_readable(). Does this even matter? And if so then is there a
> better way to distinguish between our two types of net_iovs?

Thanks for bringing this up, yes, maybe we do need a way to
distinguish, but it's not 100% critical, no? It's mostly for debug
checking?

I would say add a helper, like net_iov_is_dmabuf() or net_iov_is_io_uring().

Checking for niov->pp->mp_ops seems a bit hacky to me, and may be
outright broken. IIRC niov's can be disconnected from the page_pool
via page_pool_clear_pp_info(), and niov->pp may be null. Abstractly
speaking the niov type maybe should be a property of the niov itself,
and not the pp the niov is attached to.

It is not immediately obvious to me what the best thing to do here is,
maybe it's best to add a flag to niov or to use niov->pp_magic for
this.

I would humbly ask that your follow up patchset takes care of this
bit, if possible. I think mine is doing quite a bit of heavy lifting
as is (and I think may be close to ready?), when it comes to concerns
of devmem + io_uring coexisting if you're able to take care, awesome,
if not, I can look into squashing some fix.

-- 

Re: [PATCH RESEND 1/3] drm/panel: sitronix-st7789v: fix timing for jt240mhqs_hwt_ek_e3 panel

2024-05-28 Thread Jessica Zhang




On 5/28/2024 1:32 AM, Gerald Loacker wrote:

Flickering was observed when using partial mode. Moving the vsync to the
same position as used by the default sitronix-st7789v timing resolves this
issue.

Signed-off-by: Gerald Loacker 


Hi Gerald,

Just wondering, are these new timing values taken from the panel specs? 
If the timing in the original patch was wrong, maybe we need a fixes tag.


Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c 
b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index 88e80fe98112..32e5c0348038 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -286,9 +286,9 @@ static const struct drm_display_mode 
jt240mhqs_hwt_ek_e3_mode = {
.hsync_end = 240 + 28 + 10,
.htotal = 240 + 28 + 10 + 10,
.vdisplay = 280,
-   .vsync_start = 280 + 8,
-   .vsync_end = 280 + 8 + 4,
-   .vtotal = 280 + 8 + 4 + 4,
+   .vsync_start = 280 + 48,
+   .vsync_end = 280 + 48 + 4,
+   .vtotal = 280 + 48 + 4 + 4,
.width_mm = 43,
.height_mm = 37,
.flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,

--
2.37.2



RE: [PATCH] udmabuf: add CONFIG_MMU dependency

2024-05-28 Thread Kasireddy, Vivek
> From: Arnd Bergmann 
> 
> There is no !CONFIG_MMU version of vmf_insert_pfn():
> 
> arm-linux-gnueabi-ld: drivers/dma-buf/udmabuf.o: in function
> `udmabuf_vm_fault':
> udmabuf.c:(.text+0xaa): undefined reference to `vmf_insert_pfn'
> 
> Fixes: f7254e043ff1 ("udmabuf: use vmf_insert_pfn and VM_PFNMAP for
> handling mmap")
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/dma-buf/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
> index e4dc53a36428..b46eb8a552d7 100644
> --- a/drivers/dma-buf/Kconfig
> +++ b/drivers/dma-buf/Kconfig
> @@ -35,6 +35,7 @@ config UDMABUF
>   default n
>   depends on DMA_SHARED_BUFFER
>   depends on MEMFD_CREATE || COMPILE_TEST
> + depends on MMU
Thank you for the fix!
Acked-by: Vivek Kasireddy 

>   help
> A driver to let userspace turn memfd regions into dma-bufs.
> Qemu can use this to create host dmabufs for guest framebuffers.
> --
> 2.39.2
> 



Re: [PATCH] drm/panel: sitronix-st7789v: Add check for of_drm_get_panel_orientation

2024-05-28 Thread Jessica Zhang




On 5/27/2024 8:08 PM, Chen Ni wrote:

Add check for the return value of of_drm_get_panel_orientation() and
return the error if it fails in order to catch the error.

Fixes: b27c0f6d208d ("drm/panel: sitronix-st7789v: add panel orientation 
support")
Signed-off-by: Chen Ni 


Hi Chen Ni,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c 
b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index 88e80fe98112..8b15e225bf37 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -643,7 +643,9 @@ static int st7789v_probe(struct spi_device *spi)
if (ret)
return dev_err_probe(dev, ret, "Failed to get backlight\n");
  
-	of_drm_get_panel_orientation(spi->dev.of_node, >orientation);

+   ret = of_drm_get_panel_orientation(spi->dev.of_node, >orientation);
+   if (ret)
+   return dev_err_probe(>dev, ret, "Failed to get 
orientation\n");
  
  	drm_panel_add(>panel);
  
--

2.25.1



Re: [PATCH v2] drm/i915: Increase FLR timeout from 3s to 9s

2024-05-28 Thread Rodrigo Vivi
On Mon, May 27, 2024 at 04:00:25PM +0100, Andi Shyti wrote:
> On Mon, May 27, 2024 at 11:47:49AM +0100, Andi Shyti wrote:
> > On Fri, May 24, 2024 at 10:07:44AM -0400, Rodrigo Vivi wrote:
> > > On Fri, May 24, 2024 at 01:58:53AM +0200, Andi Shyti wrote:
> > > > Following the guidelines it takes 3 seconds to perform an FLR
> > > > reset. Let's give it a bit more slack because this time can
> > > > change depending on the platform and on the firmware
> > > 
> > > But did we see any issue with that?
> > 
> > yes, we have some FLR expiration timeouts that apparently are not
> > able to bring up the device and the memory is not accessible
> > anymore. It's worth giving it a bit more time.
> > 
> > > if that changes per platform and per firmware, shouldn't it all
> > > be explicit in the spec as well?
> > 
> > Is it always documented? We might anyway die after the FLR reset
> > failure, so that I see it quite safe to wait and pray a little
> > more.
> 
> if needed I can improve the log with the dmesg error print.

very good points indeed. I believe it would be worth some mentions
about the faced issues and good idea about dmesg as well. but up to you.

Reviewed-by: Rodrigo Vivi 

> 
> Andi


  1   2   3   >