diff options
| author | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-05-20 13:58:54 +0200 | 
|---|---|---|
| committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-05-20 13:58:54 +0200 | 
| commit | e6828be5edcfea25cd70a2d1de41085c67ef9fa5 (patch) | |
| tree | 489ae4cdb47a4d83940e2472f49a3c601806b70e /tools/perf/util/session.c | |
| parent | 1fefc8ecb834c88edfc27e712d683872d0c541dd (diff) | |
| parent | c47452194641b5d27c20e557c84a46c85fd7ce37 (diff) | |
Merge tag 'spi-nor/for-5.19' into mtd/next
SPI NOR core changes:
- Read back written SR value to make sure the write was done correctly.
- Introduce a common function for Read ID that manufacturer drivers can
  use to verify the Octal DTR switch worked correctly.
- Add helpers for read/write any register commands so manufacturer
  drivers don't open code it every time.
- Clarify rdsr dummy cycles documentation.
- Add debugfs entry to expose internal flash parameters and state.
SPI NOR manufacturer drivers changes:
- Add support for Winbond W25Q512NW-IM, and Eon EN25QH256A.
- Move spi_nor_write_ear() to Winbond module since only Winbond flashes
  use it.
- Rework Micron and Cypress Octal DTR enable methods to improve
  readability.
- Use the common Read ID function to verify switch to Octal DTR mode for
  Micron and Cypress flashes.
- Skip polling status on volatile register writes for Micron and Cypress
  flashes since the operation is instant.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'tools/perf/util/session.c')
| -rw-r--r-- | tools/perf/util/session.c | 15 | 
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 3b8dfe603e50..45a30040ec8d 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2095,6 +2095,7 @@ prefetch_event(char *buf, u64 head, size_t mmap_size,  	       bool needs_swap, union perf_event *error)  {  	union perf_event *event; +	u16 event_size;  	/*  	 * Ensure we have enough space remaining to read @@ -2107,15 +2108,23 @@ prefetch_event(char *buf, u64 head, size_t mmap_size,  	if (needs_swap)  		perf_event_header__bswap(&event->header); -	if (head + event->header.size <= mmap_size) +	event_size = event->header.size; +	if (head + event_size <= mmap_size)  		return event;  	/* We're not fetching the event so swap back again */  	if (needs_swap)  		perf_event_header__bswap(&event->header); -	pr_debug("%s: head=%#" PRIx64 " event->header_size=%#x, mmap_size=%#zx:" -		 " fuzzed or compressed perf.data?\n",__func__, head, event->header.size, mmap_size); +	/* Check if the event fits into the next mmapped buf. */ +	if (event_size <= mmap_size - head % page_size) { +		/* Remap buf and fetch again. */ +		return NULL; +	} + +	/* Invalid input. Event size should never exceed mmap_size. */ +	pr_debug("%s: head=%#" PRIx64 " event->header.size=%#x, mmap_size=%#zx:" +		 " fuzzed or compressed perf.data?\n", __func__, head, event_size, mmap_size);  	return error;  }  | 
