public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Harshvardhan Jha <harshvardhan.j.jha@oracle.com>,
	Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 5.15.y v3 1/1] xen/swiotlb: relax alignment requirements
Date: Wed, 21 May 2025 22:07:55 -0400	[thread overview]
Message-ID: <20250521140408-80ce9f2f759085ea@stable.kernel.org> (raw)
In-Reply-To: <20250521085144.1578880-2-harshvardhan.j.jha@oracle.com>

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected.
No action required from the submitter.

The upstream commit SHA1 provided is correct: 85fcb57c983f423180ba6ec5d0034242da05cc54

WARNING: Author mismatch between patch and upstream commit:
Backport author: Harshvardhan Jha<harshvardhan.j.jha@oracle.com>
Commit author: Juergen Gross<jgross@suse.com>

Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.12.y | Present (different SHA1: 5a10af375347)
6.6.y | Present (different SHA1: 461d9e8acaa4)
6.1.y | Present (different SHA1: 099606a7b2d5)

Note: The patch differs from the upstream commit:
---
1:  85fcb57c983f4 ! 1:  d8109ab010afb xen/swiotlb: relax alignment requirements
    @@
      ## Metadata ##
    -Author: Juergen Gross <jgross@suse.com>
    +Author: Harshvardhan Jha <harshvardhan.j.jha@oracle.com>
     
      ## Commit message ##
         xen/swiotlb: relax alignment requirements
     
    +    [ Upstream commit 85fcb57c983f423180ba6ec5d0034242da05cc54 ]
    +
         When mapping a buffer for DMA via .map_page or .map_sg DMA operations,
         there is no need to check the machine frames to be aligned according
         to the mapped areas size. All what is needed in these cases is that the
    @@ Commit message
         xen_swiotlb_free_coherent() directly.
     
         Fixes: 9f40ec84a797 ("xen/swiotlb: add alignment check for dma buffers")
    -    Reported-by: Jan Vejvalka <jan.vejvalka@lfmotol.cuni.cz>
    -    Tested-by: Jan Vejvalka <jan.vejvalka@lfmotol.cuni.cz>
    -    Signed-off-by: Juergen Gross <jgross@suse.com>
    -    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    +
         Signed-off-by: Juergen Gross <jgross@suse.com>
    +    Signed-off-by: Harshvardhan Jha <harshvardhan.j.jha@oracle.com>
     
      ## drivers/xen/swiotlb-xen.c ##
     @@ drivers/xen/swiotlb-xen.c: static inline phys_addr_t xen_dma_to_phys(struct device *dev,
    @@ drivers/xen/swiotlb-xen.c: static inline phys_addr_t xen_dma_to_phys(struct devi
      	for (i = 1; i < nr_pages; i++)
      		if (pfn_to_bfn(++xen_pfn) != ++next_bfn)
      			return 1;
    -@@ drivers/xen/swiotlb-xen.c: xen_swiotlb_alloc_coherent(struct device *dev, size_t size,
    - 
    - 	*dma_handle = xen_phys_to_dma(dev, phys);
    - 	if (*dma_handle + size - 1 > dma_mask ||
    --	    range_straddles_page_boundary(phys, size)) {
    -+	    range_straddles_page_boundary(phys, size) ||
    -+	    range_requires_alignment(phys, size)) {
    - 		if (xen_create_contiguous_region(phys, order, fls64(dma_mask),
    - 				dma_handle) != 0)
    - 			goto out_free_pages;
    -@@ drivers/xen/swiotlb-xen.c: xen_swiotlb_free_coherent(struct device *dev, size_t size, void *vaddr,
    - 	size = ALIGN(size, XEN_PAGE_SIZE);
    +@@ drivers/xen/swiotlb-xen.c: xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
    + 	phys = dma_to_phys(hwdev, *dma_handle);
    + 	dev_addr = xen_phys_to_dma(hwdev, phys);
    + 	if (((dev_addr + size - 1 <= dma_mask)) &&
    +-	    !range_straddles_page_boundary(phys, size))
    ++	    !range_straddles_page_boundary(phys, size) &&
    ++	    !range_requires_alignment(phys, size))
    + 		*dma_handle = dev_addr;
    + 	else {
    + 		if (xen_create_contiguous_region(phys, order,
    +@@ drivers/xen/swiotlb-xen.c: xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
      
    - 	if (WARN_ON_ONCE(dma_handle + size - 1 > dev->coherent_dma_mask) ||
    --	    WARN_ON_ONCE(range_straddles_page_boundary(phys, size)))
    -+	    WARN_ON_ONCE(range_straddles_page_boundary(phys, size) ||
    -+			 range_requires_alignment(phys, size)))
    - 	    	return;
    + 	if (!WARN_ON((dev_addr + size - 1 > dma_mask) ||
    + 		     range_straddles_page_boundary(phys, size)) &&
    ++	    !range_requires_alignment(phys, size) &&
    + 	    TestClearPageXenRemapped(page))
    + 		xen_destroy_contiguous_region(phys, order);
      
    - 	if (TestClearPageXenRemapped(virt_to_page(vaddr)))
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.15.y       |  Success    |  Success   |

      reply	other threads:[~2025-05-22  2:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21  8:51 [PATCH 5.15.y v3 0/1] Manual Backport of 099606a7b2d5 to 5.15 Harshvardhan Jha
2025-05-21  8:51 ` [PATCH 5.15.y v3 1/1] xen/swiotlb: relax alignment requirements Harshvardhan Jha
2025-05-22  2:07   ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250521140408-80ce9f2f759085ea@stable.kernel.org \
    --to=sashal@kernel.org \
    --cc=harshvardhan.j.jha@oracle.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox