183e2ec76SGeorge Zhang /*
283e2ec76SGeorge Zhang  * VMware VMCI Driver
383e2ec76SGeorge Zhang  *
483e2ec76SGeorge Zhang  * Copyright (C) 2012 VMware, Inc. All rights reserved.
583e2ec76SGeorge Zhang  *
683e2ec76SGeorge Zhang  * This program is free software; you can redistribute it and/or modify it
783e2ec76SGeorge Zhang  * under the terms of the GNU General Public License as published by the
883e2ec76SGeorge Zhang  * Free Software Foundation version 2 and no later version.
983e2ec76SGeorge Zhang  *
1083e2ec76SGeorge Zhang  * This program is distributed in the hope that it will be useful, but
1183e2ec76SGeorge Zhang  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1283e2ec76SGeorge Zhang  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1383e2ec76SGeorge Zhang  * for more details.
1483e2ec76SGeorge Zhang  */
1583e2ec76SGeorge Zhang 
1683e2ec76SGeorge Zhang #ifndef VMCI_DOORBELL_H
1783e2ec76SGeorge Zhang #define VMCI_DOORBELL_H
1883e2ec76SGeorge Zhang 
1983e2ec76SGeorge Zhang #include <linux/vmw_vmci_defs.h>
2083e2ec76SGeorge Zhang #include <linux/types.h>
2183e2ec76SGeorge Zhang 
2283e2ec76SGeorge Zhang #include "vmci_driver.h"
2383e2ec76SGeorge Zhang 
2483e2ec76SGeorge Zhang /*
2583e2ec76SGeorge Zhang  * VMCINotifyResourceInfo: Used to create and destroy doorbells, and
2683e2ec76SGeorge Zhang  * generate a notification for a doorbell or queue pair.
2783e2ec76SGeorge Zhang  */
2883e2ec76SGeorge Zhang struct vmci_dbell_notify_resource_info {
2983e2ec76SGeorge Zhang 	struct vmci_handle handle;
3083e2ec76SGeorge Zhang 	u16 resource;
3183e2ec76SGeorge Zhang 	u16 action;
3283e2ec76SGeorge Zhang 	s32 result;
3383e2ec76SGeorge Zhang };
3483e2ec76SGeorge Zhang 
3583e2ec76SGeorge Zhang /*
3683e2ec76SGeorge Zhang  * Structure used for checkpointing the doorbell mappings. It is
3783e2ec76SGeorge Zhang  * written to the checkpoint as is, so changing this structure will
3883e2ec76SGeorge Zhang  * break checkpoint compatibility.
3983e2ec76SGeorge Zhang  */
4083e2ec76SGeorge Zhang struct dbell_cpt_state {
4183e2ec76SGeorge Zhang 	struct vmci_handle handle;
4283e2ec76SGeorge Zhang 	u64 bitmap_idx;
4383e2ec76SGeorge Zhang };
4483e2ec76SGeorge Zhang 
4583e2ec76SGeorge Zhang int vmci_dbell_host_context_notify(u32 src_cid, struct vmci_handle handle);
4683e2ec76SGeorge Zhang int vmci_dbell_get_priv_flags(struct vmci_handle handle, u32 *priv_flags);
4783e2ec76SGeorge Zhang 
48f2db7361SVishnu DASA bool vmci_dbell_register_notification_bitmap(u64 bitmap_ppn);
4983e2ec76SGeorge Zhang void vmci_dbell_scan_notification_entries(u8 *bitmap);
5083e2ec76SGeorge Zhang 
5183e2ec76SGeorge Zhang #endif /* VMCI_DOORBELL_H */
52