MMC host:

- davinci_mmc: Prevent transmitted data size from exceeding sgm's length
  - sdhci: Fix max_seg_size for 64KiB PAGE_SIZE
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmaRQN4XHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCmBEw/8DVEsUdFIXJwM9TE8UjOuIzuU
 Z7Z/wcR4TLf9nXdxOjTlnjC9+iGK76zSLnWD5jkRomMhHDXZGWzMreygcHzcmzpp
 dP2bKypNRdRXzfkimJCtEpJ7qUvp1yDvfS849yOUDxNu9z9Usu/25B9TcYxyNLai
 ffGsubyfDM8kwhtt1S3Aksl6F948BF53oYH/eBJAoE0uNBNcfZ9DQb1djEIef6L9
 27Z737SMoxXs9CT/o7qhJTJENz0RUmf6kuuCpCO32AdkNRt8C8BgSR8outzmM72T
 HRhlkW0YfCu6GCW81+1FHGO7pKYzPIyTCV5V3K+kvrRFpeejV1ZLAlTjwFh2q7B0
 FVpGv40pUeURykO+CQ1VQwIo0sChWaZTgvPtuLhWShau1jZ4mI7SFaooSM12Et8Q
 iTyE/aEhNQqTK8npHm9iK1HXLFCQtrI6ZRMzfDEMRnOzYyoLXkx9/LWbnxysMeKy
 G4nABNettzJ66poeElhnqMBjAWL/vfpSz2XcxkWmXsXG2C+wtPFk1tqoSafduIx9
 7iO7Wfg4wzpbdy03WJuEjW1GmQe36LPgLsoxdcjH/nZoC748EE70eAK964QO2mtt
 n4UKrCoWLfJMtQXoxgFLD2F/N+/Nm8xjPAef3MT+dKgkJb/UNdGpEqu24nc1i6Mu
 gaqW9lydk7gQIBGivSY=
 =vOaf
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v6.10-rc4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC host fixes from Ulf Hansson:

 - davinci_mmc: Prevent transmitted data size from exceeding sgm's
   length

 - sdhci: Fix max_seg_size for 64KiB PAGE_SIZE

* tag 'mmc-v6.10-rc4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: davinci_mmc: Prevent transmitted data size from exceeding sgm's length
  mmc: sdhci: Fix max_seg_size for 64KiB PAGE_SIZE
This commit is contained in:
Linus Torvalds 2024-07-12 10:26:48 -07:00
commit 01ec3bb6ea
2 changed files with 18 additions and 0 deletions

View File

@ -224,6 +224,9 @@ static void davinci_fifo_data_trans(struct mmc_davinci_host *host,
}
p = sgm->addr;
if (n > sgm->length)
n = sgm->length;
/* NOTE: we never transfer more than rw_threshold bytes
* to/from the fifo here; there's no I/O overlap.
* This also assumes that access width( i.e. ACCWD) is 4 bytes

View File

@ -4727,6 +4727,21 @@ int sdhci_setup_host(struct sdhci_host *host)
if (host->quirks & SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC) {
host->max_adma = 65532; /* 32-bit alignment */
mmc->max_seg_size = 65535;
/*
* sdhci_adma_table_pre() expects to define 1 DMA
* descriptor per segment, so the maximum segment size
* is set accordingly. SDHCI allows up to 64KiB per DMA
* descriptor (16-bit field), but some controllers do
* not support "zero means 65536" reducing the maximum
* for them to 65535. That is a problem if PAGE_SIZE is
* 64KiB because the block layer does not support
* max_seg_size < PAGE_SIZE, however
* sdhci_adma_table_pre() has a workaround to handle
* that case, and split the descriptor. Refer also
* comment in sdhci_adma_table_pre().
*/
if (mmc->max_seg_size < PAGE_SIZE)
mmc->max_seg_size = PAGE_SIZE;
} else {
mmc->max_seg_size = 65536;
}