Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7456aa77 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "qcom: peripheral-loader: Account for arm64 alignment requirements"

parents 9ae21283 9612c2bc
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -575,20 +575,36 @@ static int pil_load_seg(struct pil_desc *desc, struct pil_seg *seg)
	paddr = seg->paddr + seg->filesz;
	count = seg->sz - seg->filesz;
	while (count > 0) {
		int size;
		int size, orig_size;
		u8 __iomem *buf;
		u8 bytes_before;
		u8 bytes_after;

		size = min_t(size_t, IOMAP_SIZE, count);
		orig_size = size = min_t(size_t, IOMAP_SIZE, count);
		buf = ioremap(paddr, size);
		if (!buf) {
			pil_err(desc, "Failed to map memory\n");
			return -ENOMEM;
		}

		if ((unsigned long)buf & 0x7) {
			bytes_before = 8 - ((unsigned long)buf & 0x7);
			memset_io(buf, 0, bytes_before);
			size -= bytes_before;
			buf += bytes_before;
		}

		if (size & 0x7) {
			bytes_after = size & 0x7;
			memset_io(buf + size - bytes_after, 0, bytes_after);
			size -= bytes_after;
		}

		memset(buf, 0, size);
		iounmap(buf);

		count -= size;
		paddr += size;
		count -= orig_size;
		paddr += orig_size;
	}

	if (desc->ops->verify_blob) {