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

[PATCH for-4.19] x86/physdev: Return pirq that irq was already mapped to


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiqian Chen <Jiqian.Chen@xxxxxxx>
  • Date: Mon, 8 Jul 2024 14:25:54 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/tohzRVqTI0hSAsmX0f+iY/yn1JVZZtLAdvD2aQ6XSg=; b=So6GeBiX6wmDg+KTQZ17PpWOVmOQDxOFsIRgSqfYsoVZd99OUeDdoUme3m0ZmrB8tPK2bX0cKtP2V6hgbYvHoCjvyuNiO06xK+Va4Gl+v+WdZD0Uk+75U8T8XKD83HyDYvF+lQ+zfsn+Njwgi21JaEn4UgAXnP0YRM4CKBcmg0NDLjfSQS6wL2ktvipaxAOcxyHVC5Cwqa1ts3SldlE/+9Brni0EAgAxqqrX9arTesZRa8AWgEl4WmDWS8wRO+4zFq1fAdZBH5Hiid0HjzNeJydd4BHri+QCAHJja1dz4qqVk4SIVeheIcMfU5u9piUAUfmW2gsjcuVB79Sed5Wn6w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dsfo8dPeKnFft4b0tFK/ZgN1P6Q8tDAQKwakGgK+z5Zb1RR50fjL4qYNCIAnWz2SQC2tOsxeQsSZEfh8q83ttA+UloQo4YV/silIEBzP0hhjNLpx8YupA1dUnufiOtktyG1Ut65NBJNsHe9T1neGUoeStYqkOb1aHU1cNcgMKDP3fDChpPSOEAMGjW6F/VbKcxhV+TpbQnKXTiFmOobnCN2OZlCTizhcaz76/7PONU6rRIB/dpNvgTaNA2yv1kCFI5E0TnjXdQK1an/IlpvE05iorHNVxtD4g14dUV+BQRlLsFrBP2K7XLp5g82Jx9XJyMRiMP4/mRdx2L6KcJCcqw==
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, "Huang Rui" <Ray.Huang@xxxxxxx>, Jiqian Chen <Jiqian.Chen@xxxxxxx>, Huang Rui <ray.huang@xxxxxxx>
  • Delivery-date: Mon, 08 Jul 2024 06:26:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Fix bug imported by 0762e2502f1f ("x86/physdev: factor out the code to allocate 
and
map a pirq"). After that re-factoring, when pirq<0 and current_pirq>0, it means
caller want to allocate a free pirq for irq but irq already has a mapped pirq, 
then
it returns the negative pirq, so it fails. However, the logic before that
re-factoring is different, it should return the current_pirq that irq was 
already
mapped to and make the call success.

Fixes: 0762e2502f1f ("x86/physdev: factor out the code to allocate and map a 
pirq")

Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
---
 xen/arch/x86/irq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 9a611c79e024..1a827ccc8498 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2897,6 +2897,7 @@ static int allocate_pirq(struct domain *d, int index, int 
pirq, int irq,
                     d->domain_id, index, pirq, current_pirq);
             if ( current_pirq < 0 )
                 return -EBUSY;
+            pirq = current_pirq;
         }
         else if ( type == MAP_PIRQ_TYPE_MULTI_MSI )
         {
-- 
2.34.1




 


Rackspace

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