resource: Provide resource struct in resource walk callback
In preperation for a new function that will need additional resource information during the resource walk, update the resource walk callback to pass the resource structure. Since the current callback start and end arguments are pulled from the resource structure, the callback functions can obtain them from the resource structure directly. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Borislav Petkov <bp@suse.de> Tested-by: Borislav Petkov <bp@suse.de> Cc: kvm@vger.kernel.org Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Borislav Petkov <bp@alien8.de> Cc: linuxppc-dev@lists.ozlabs.org Link: https://lkml.kernel.org/r/20171020143059.3291-10-brijesh.singh@amd.com
This commit is contained in:

committed by
Thomas Gleixner

parent
4ac2aed837
commit
1d2e733b13
@@ -91,11 +91,13 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image)
|
||||
* and that value will be returned. If all free regions are visited without
|
||||
* func returning non-zero, then zero will be returned.
|
||||
*/
|
||||
int arch_kexec_walk_mem(struct kexec_buf *kbuf, int (*func)(u64, u64, void *))
|
||||
int arch_kexec_walk_mem(struct kexec_buf *kbuf,
|
||||
int (*func)(struct resource *, void *))
|
||||
{
|
||||
int ret = 0;
|
||||
u64 i;
|
||||
phys_addr_t mstart, mend;
|
||||
struct resource res = { };
|
||||
|
||||
if (kbuf->top_down) {
|
||||
for_each_free_mem_range_reverse(i, NUMA_NO_NODE, 0,
|
||||
@@ -105,7 +107,9 @@ int arch_kexec_walk_mem(struct kexec_buf *kbuf, int (*func)(u64, u64, void *))
|
||||
* range while in kexec, end points to the last byte
|
||||
* in the range.
|
||||
*/
|
||||
ret = func(mstart, mend - 1, kbuf);
|
||||
res.start = mstart;
|
||||
res.end = mend - 1;
|
||||
ret = func(&res, kbuf);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
@@ -117,7 +121,9 @@ int arch_kexec_walk_mem(struct kexec_buf *kbuf, int (*func)(u64, u64, void *))
|
||||
* range while in kexec, end points to the last byte
|
||||
* in the range.
|
||||
*/
|
||||
ret = func(mstart, mend - 1, kbuf);
|
||||
res.start = mstart;
|
||||
res.end = mend - 1;
|
||||
ret = func(&res, kbuf);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user