1st ingredient: cohomology

Choose a finite extension $K'/\mathbf{Q}_p$, with residue field $k'=\mathbf{F}_{p^m}$, so the geometric divisor classes of $X$ are defined over $K'$ and those of $X_p$ over $k'$.

Over characteristic zero we have:

Over characteristic $p$ we have: