ANDROID: virt: gunyah: Force struct gh_rm as opaque

struct gh_rm is an opaque pointer to everyone not the Gunyah Resource
Manager itself (drivers/virt/gunyah/rsc_mgr.c). The resource manager
provides functions (gh_rm_call, gh_rm_{un}register_notifier) for
entities to communicate with the resource manager. An opaque pointer is
provided to those entities and passed back in when making those calls.

Although Linux CRCs would be unaffected by internal changes to struct
gh_rm, Android KMI tracking unrolls the definition of struct gh_rm it
finds in drivers/virt/gunyah/rsc_mgr.c and would be subject to KMI
freeze. Since this is a private structure not accessible to vendor/OEM
drivers, replace the "struct gh_rm *" with "void *" on any KMI-tracked
symbol.

function symbol changed from 'int gh_rm_call(struct gh_rm*, u32, void*, size_t, void**, size_t*)' to 'int gh_rm_call(void*, u32, void*, size_t, void**, size_t*)'
  CRC changed from 0xfef4ce1d to 0x162db09d
  type changed from 'int(struct gh_rm*, u32, void*, size_t, void**, size_t*)' to 'int(void*, u32, void*, size_t, void**, size_t*)'
    parameter 1 type changed from 'struct gh_rm*' to 'void*'
      pointed-to type changed from 'struct gh_rm' to 'void'

function symbol changed from 'int gh_rm_notifier_register(struct gh_rm*, struct notifier_block*)' to 'int gh_rm_notifier_register(void*, struct notifier_block*)'
  CRC changed from 0x412fac09 to 0xd5a6a3c9
  type changed from 'int(struct gh_rm*, struct notifier_block*)' to 'int(void*, struct notifier_block*)'
    parameter 1 type changed from 'struct gh_rm*' to 'void*'
      pointed-to type changed from 'struct gh_rm' to 'void'

function symbol changed from 'int gh_rm_notifier_unregister(struct gh_rm*, struct notifier_block*)' to 'int gh_rm_notifier_unregister(void*, struct notifier_block*)'
  CRC changed from 0xf4d771f8 to 0x2c865d28
  type changed from 'int(struct gh_rm*, struct notifier_block*)' to 'int(void*, struct notifier_block*)'
    parameter 1 type changed from 'struct gh_rm*' to 'void*'
      pointed-to type changed from 'struct gh_rm' to 'void'

function symbol 'int devm_gh_rm_register_platform_ops(struct device*, struct gh_rm_platform_ops*)' changed
  CRC changed from 0xb51b6569 to 0xa6a1478a

function symbol 'int gh_rm_register_platform_ops(struct gh_rm_platform_ops*)' changed
  CRC changed from 0xa577ae43 to 0x110877e8

function symbol 'void gh_rm_unregister_platform_ops(struct gh_rm_platform_ops*)' changed
  CRC changed from 0x5759f053 to 0x2e3c1910

type 'struct gh_rm_platform_ops' changed
  member changed from 'int(* pre_mem_share)(struct gh_rm*, struct gh_rm_mem_parcel*)' to 'int(* pre_mem_share)(void*, struct gh_rm_mem_parcel*)'
    type changed from 'int(*)(struct gh_rm*, struct gh_rm_mem_parcel*)' to 'int(*)(void*, struct gh_rm_mem_parcel*)'
      pointed-to type changed from 'int(struct gh_rm*, struct gh_rm_mem_parcel*)' to 'int(void*, struct gh_rm_mem_parcel*)'
        parameter 1 type changed from 'struct gh_rm*' to 'void*'
          pointed-to type changed from 'struct gh_rm' to 'void'
  member changed from 'int(* post_mem_reclaim)(struct gh_rm*, struct gh_rm_mem_parcel*)' to 'int(* post_mem_reclaim)(void*, struct gh_rm_mem_parcel*)'
    type changed from 'int(*)(struct gh_rm*, struct gh_rm_mem_parcel*)' to 'int(*)(void*, struct gh_rm_mem_parcel*)'
      pointed-to type changed from 'int(struct gh_rm*, struct gh_rm_mem_parcel*)' to 'int(void*, struct gh_rm_mem_parcel*)'
        parameter 1 type changed from 'struct gh_rm*' to 'void*'
          pointed-to type changed from 'struct gh_rm' to 'void'

Bug: 282937940
Change-Id: Ie775c668c95bee0d1c91862eebf8fd0f606ff309
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
This commit is contained in:
Elliot Berman
2023-05-13 12:15:08 -07:00
committed by Carlos Llamas
parent 062e3b40a3
commit 04ea3d3ace
4 changed files with 16 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
#define QCOM_SCM_RM_MANAGED_VMID 0x3A
#define QCOM_SCM_MAX_MANAGED_VMID 0x3F
static int qcom_scm_gh_rm_pre_mem_share(struct gh_rm *rm, struct gh_rm_mem_parcel *mem_parcel)
static int qcom_scm_gh_rm_pre_mem_share(void *rm, struct gh_rm_mem_parcel *mem_parcel)
{
struct qcom_scm_vmperm *new_perms;
u64 src, src_cpy;
@@ -72,7 +72,7 @@ static int qcom_scm_gh_rm_pre_mem_share(struct gh_rm *rm, struct gh_rm_mem_parce
return ret;
}
static int qcom_scm_gh_rm_post_mem_reclaim(struct gh_rm *rm, struct gh_rm_mem_parcel *mem_parcel)
static int qcom_scm_gh_rm_post_mem_reclaim(void *rm, struct gh_rm_mem_parcel *mem_parcel)
{
struct qcom_scm_vmperm new_perms;
u64 src = 0, src_cpy;

View File

@@ -631,9 +631,10 @@ out:
* Context: Process context. Will sleep waiting for reply.
* Return: 0 on success. <0 if error.
*/
int gh_rm_call(struct gh_rm *rm, u32 message_id, void *req_buf, size_t req_buf_size,
int gh_rm_call(void *_rm, u32 message_id, void *req_buf, size_t req_buf_size,
void **resp_buf, size_t *resp_buf_size)
{
struct gh_rm *rm = _rm;
struct gh_rm_connection *connection;
u32 seq_id;
int ret;
@@ -708,14 +709,18 @@ free:
EXPORT_SYMBOL_GPL(gh_rm_call);
int gh_rm_notifier_register(struct gh_rm *rm, struct notifier_block *nb)
int gh_rm_notifier_register(void *_rm, struct notifier_block *nb)
{
struct gh_rm *rm = _rm;
return blocking_notifier_chain_register(&rm->nh, nb);
}
EXPORT_SYMBOL_GPL(gh_rm_notifier_register);
int gh_rm_notifier_unregister(struct gh_rm *rm, struct notifier_block *nb)
int gh_rm_notifier_unregister(void *_rm, struct notifier_block *nb)
{
struct gh_rm *rm = _rm;
return blocking_notifier_chain_unregister(&rm->nh, nb);
}
EXPORT_SYMBOL_GPL(gh_rm_notifier_unregister);

View File

@@ -10,7 +10,7 @@
#include <linux/types.h>
struct gh_rm;
int gh_rm_call(struct gh_rm *rsc_mgr, u32 message_id, void *req_buf, size_t req_buf_size,
int gh_rm_call(void *rsc_mgr, u32 message_id, void *req_buf, size_t req_buf_size,
void **resp_buf, size_t *resp_buf_size);
int gh_rm_platform_pre_mem_share(struct gh_rm *rm, struct gh_rm_mem_parcel *mem_parcel);

View File

@@ -14,10 +14,10 @@
#define GH_MEM_HANDLE_INVAL U32_MAX
struct gh_rm;
int gh_rm_call(struct gh_rm *rm, u32 message_id, void *req_buf, size_t req_buf_size,
int gh_rm_call(void *rm, u32 message_id, void *req_buf, size_t req_buf_size,
void **resp_buf, size_t *resp_buf_size);
int gh_rm_notifier_register(struct gh_rm *rm, struct notifier_block *nb);
int gh_rm_notifier_unregister(struct gh_rm *rm, struct notifier_block *nb);
int gh_rm_notifier_register(void *rm, struct notifier_block *nb);
int gh_rm_notifier_unregister(void *rm, struct notifier_block *nb);
struct device *gh_rm_get(struct gh_rm *rm);
void gh_rm_put(struct gh_rm *rm);
@@ -147,8 +147,8 @@ struct gh_resource *gh_rm_alloc_resource(struct gh_rm *rm, struct gh_rm_hyp_reso
void gh_rm_free_resource(struct gh_resource *ghrsc);
struct gh_rm_platform_ops {
int (*pre_mem_share)(struct gh_rm *rm, struct gh_rm_mem_parcel *mem_parcel);
int (*post_mem_reclaim)(struct gh_rm *rm, struct gh_rm_mem_parcel *mem_parcel);
int (*pre_mem_share)(void *rm, struct gh_rm_mem_parcel *mem_parcel);
int (*post_mem_reclaim)(void *rm, struct gh_rm_mem_parcel *mem_parcel);
};
#if IS_ENABLED(CONFIG_GUNYAH_PLATFORM_HOOKS)