/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef __GENERIC_PT_COMMON_H
#define __GENERIC_PT_COMMON_H

#include <linux/types.h>
#include <linux/build_bug.h>
#include <linux/bits.h>




struct pt_common {
	
	uintptr_t top_of_table;
	
	u8 max_oasz_lg2;
	
	u8 max_vasz_lg2;
	
	unsigned int features;
};


enum {
	PT_TOP_LEVEL_BITS = 3,
	PT_TOP_LEVEL_MASK = GENMASK(PT_TOP_LEVEL_BITS - 1, 0),
};


enum pt_features {
	
	PT_FEAT_DMA_INCOHERENT,
	
	PT_FEAT_FULL_VA,
	
	PT_FEAT_DYNAMIC_TOP,
	
	PT_FEAT_SIGN_EXTEND,
	
	PT_FEAT_FLUSH_RANGE,
	
	PT_FEAT_FLUSH_RANGE_NO_GAPS,
	
	PT_FEAT_FMT_START,
};

struct pt_amdv1 {
	struct pt_common common;
};

enum {
	
	PT_FEAT_AMDV1_ENCRYPT_TABLES = PT_FEAT_FMT_START,
	
	PT_FEAT_AMDV1_FORCE_COHERENCE,
};

struct pt_vtdss {
	struct pt_common common;
};

enum {
	
	PT_FEAT_VTDSS_FORCE_COHERENCE = PT_FEAT_FMT_START,
	
	PT_FEAT_VTDSS_FORCE_WRITEABLE,
};

struct pt_x86_64 {
	struct pt_common common;
};

enum {
	
	PT_FEAT_X86_64_AMD_ENCRYPT_TABLES = PT_FEAT_FMT_START,
};

#endif
